From ec8f8b835eec9be93ebe4003492f2dbd027f6aa7 Mon Sep 17 00:00:00 2001 From: Jay Pfaffman Date: Wed, 20 Apr 2016 12:02:17 -0500 Subject: [PATCH] Add mail config sanity check Checks that all SMTP config variables are set. If not, a warning is printed and user gets option to ^C to fix. --- launcher | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/launcher b/launcher index ed91e79..50e819d 100755 --- a/launcher +++ b/launcher @@ -313,7 +313,6 @@ set_template_info() { input="hack: true" - for template in "${arrTemplates[@]}" do [ ! -z $template ] && { @@ -403,7 +402,6 @@ if [ ! -e $config_file ] exit 1 fi - docker_version=($($docker_path --version)) docker_version=${test[2]//,/} @@ -537,12 +535,38 @@ run_start(){ } +mail_config_check(){ + mail_config_verbose=0 # 1 prints mail config to stdout + mail_config="ok" + for x in DISCOURSE_SMTP_ADDRESS DISCOURSE_SMTP_USER_NAME DISCOURSE_SMTP_PASSWORD \ + DISCOURSE_SMTP_PORT DISCOURSE_SMTP_ENABLE_START_TLS + do + mail_var=`grep "^ $x:" $config_file` + result=$? + if (( result == 0 )) + then + if [ "$mail_config_verbose" -eq 1 ]; then + echo "$mail_var" + fi + else + echo "Warning: $x not configured." + mail_config="dubious" + fi + done + if [ -t 0 ] && [ "$mail_config" != "ok" ]; then + echo + read -p "Press ENTER to continue, or Ctrl-C to exit and fix your mail config." + fi +} + run_bootstrap(){ if [ "$opt" != "--skip-prereqs" ] ; then - check_resources + check_resources fi + mail_config_check + host_run get_ssh_pub_key -- 2.25.1