From fc9fbedfac76398ca5b6cddd4246a38364fa68f4 Mon Sep 17 00:00:00 2001 From: "Derek J. Lambert" Date: Sun, 18 Aug 2024 17:35:56 -0500 Subject: [PATCH] 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 --- discourse-setup | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/discourse-setup b/discourse-setup index a037100..0629490 100755 --- a/discourse-setup +++ b/discourse-setup @@ -448,14 +448,14 @@ ask_user_for_config() { local smtp_port=$read_config_result read_config "DISCOURSE_SMTP_USER_NAME" local smtp_user_name=$read_config_result - if [ "$smtp_password" = "pa$$word" ] + if [ "$smtp_password" = "pa\$\$word" ] then - smtp_password = "" + smtp_password="" fi read_config "DISCOURSE_NOTIFICATION_EMAIL" local notification_email=$read_config_result read_config "DISCOURSE_SMTP_DOMAIN" - local discourse_smtp_DOMAIN=$read_config_result + local discourse_smtp_domain=$read_config_result read_config "LETSENCRYPT_ACCOUNT_EMAIL" local letsencrypt_account_email=$read_config_result @@ -563,7 +563,7 @@ ask_user_for_config() { then if [ "$smtp_address" == "smtp.sparkpostmail.com" ] then - smtp_user_name="SMTP_Injection" + smtp_user_name="SMTP_Injection" fi if [ "$smtp_address" == "smtp.sendgrid.net" ] then @@ -602,7 +602,9 @@ ask_user_for_config() { fi # set smtp_domain default value here rather than use Rails default of localhost - smtp_domain=$(echo $notification_email | sed -e "s/.*@//") + default_smtp_domain=${notification_email#*@} + # if DISCOURSE_SMTP_DOMAIN is in the config use that instead + smtp_domain=${discourse_smtp_domain:-${default_smtp_domain}} if [ ! -z $letsencrypt_account_email ] then @@ -748,8 +750,8 @@ ask_user_for_config() { then SLASH="Q" if [[ "$smtp_password" == *"$SLASH"* ]] - then - SLASH="BROKEN" + then + SLASH="BROKEN" echo "========================================" echo "WARNING!!!" echo "Your password contains all available delimiters (+, |, and Q). " -- 2.25.1