Skip to content

Commit fc9fbed

Browse files
authored
FIX: Broken config and variable handling in setup script (#693)
* FIX: Variable isn't being set * DEV: Goodbye tabs, they're probably feeling lonely anyway * FIX: Variable is never used. No need for command substitution * FIX: The likelihood of knowing the PID for the script before execution is exceptionally low
1 parent b7a6888 commit fc9fbed

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

discourse-setup

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,14 @@ ask_user_for_config() {
448448
local smtp_port=$read_config_result
449449
read_config "DISCOURSE_SMTP_USER_NAME"
450450
local smtp_user_name=$read_config_result
451-
if [ "$smtp_password" = "pa$$word" ]
451+
if [ "$smtp_password" = "pa\$\$word" ]
452452
then
453-
smtp_password = ""
453+
smtp_password=""
454454
fi
455455
read_config "DISCOURSE_NOTIFICATION_EMAIL"
456456
local notification_email=$read_config_result
457457
read_config "DISCOURSE_SMTP_DOMAIN"
458-
local discourse_smtp_DOMAIN=$read_config_result
458+
local discourse_smtp_domain=$read_config_result
459459

460460
read_config "LETSENCRYPT_ACCOUNT_EMAIL"
461461
local letsencrypt_account_email=$read_config_result
@@ -563,7 +563,7 @@ ask_user_for_config() {
563563
then
564564
if [ "$smtp_address" == "smtp.sparkpostmail.com" ]
565565
then
566-
smtp_user_name="SMTP_Injection"
566+
smtp_user_name="SMTP_Injection"
567567
fi
568568
if [ "$smtp_address" == "smtp.sendgrid.net" ]
569569
then
@@ -602,7 +602,9 @@ ask_user_for_config() {
602602
fi
603603

604604
# set smtp_domain default value here rather than use Rails default of localhost
605-
smtp_domain=$(echo $notification_email | sed -e "s/.*@//")
605+
default_smtp_domain=${notification_email#*@}
606+
# if DISCOURSE_SMTP_DOMAIN is in the config use that instead
607+
smtp_domain=${discourse_smtp_domain:-${default_smtp_domain}}
606608

607609
if [ ! -z $letsencrypt_account_email ]
608610
then
@@ -748,8 +750,8 @@ ask_user_for_config() {
748750
then
749751
SLASH="Q"
750752
if [[ "$smtp_password" == *"$SLASH"* ]]
751-
then
752-
SLASH="BROKEN"
753+
then
754+
SLASH="BROKEN"
753755
echo "========================================"
754756
echo "WARNING!!!"
755757
echo "Your password contains all available delimiters (+, |, and Q). "

0 commit comments

Comments
 (0)