feature: discourse-setup email config improvements
[discourse_docker.git] / tests / standalone
CommitLineData
cc5b00a4
JP
1#!/usr/bin/env bash
2DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3YML=$DIR/../containers/app.yml
4if [ -f $YML ]
5then
6 echo "cannot run test if $YML exists."
7 exit
8fi
9
10check_value () {
11 VAR=$1
12 VAL=$2
13 YML=$3
14 if ! [[ $(grep $VAR $YML |sed -e "s/ $VAR: //") == "$VAL" ]]
15 then
16 echo $VAR is NOT $VAL
17 echo TEST FAILED. Aborting.
18 exit 1
19 fi
20}
21
22hostname='test.myhost.com'
23developer='admin@mail.myhost.com'
24smtp_address='smtp.myhostn.com'
25smtp_port=''
26smtp_user='smtpuser'
27smtp_pass='smtp-pw'
28notification=''
29letsencrypt='le@myhost.com'
30maxmind=''
31$DIR/../discourse-setup --skip-connection-test --skip-rebuild <<EOF
32$hostname
33$developer
34$smtp_address
35$smtp_port
36$smtp_user
37$smtp_pass
38$notification
39$letsencrypt
40$maxmind
41
42
43EOF
44check_value DISCOURSE_HOSTNAME $hostname $YML
45check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
46check_value DISCOURSE_SMTP_PORT 587 $YML
47check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
48check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
49check_value DISCOURSE_SMTP_DOMAIN $hostname $YML
50check_value DISCOURSE_NOTIFICATION_EMAIL noreply@$hostname $YML
51echo "################################ Initial install succeeded. ###################################"
52echo "Now running edit test."
53hostname='new.myhost.com'
54developer='new@mail.myhost.com'
55smtp_address='new.myhostn.com'
56smtp_port='2525'
57smtp_user='newuser'
58smtp_pass='new-smtp-pw'
59notification='somuser@otherhost.com'
60smtp_domain=otherhost.com # NOTE: script uses notification hostnme
61letsencrypt='le-new@myhost.com'
62maxmind='maxthisone'
63$DIR/../discourse-setup --skip-connection-test --skip-rebuild <<EOF
64$hostname
65$developer
66$smtp_address
67$smtp_port
68$smtp_user
69$smtp_pass
70$notification
71$letsencrypt
72$maxmind
73
74
75EOF
76check_value DISCOURSE_HOSTNAME $hostname $YML
77check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
78check_value DISCOURSE_SMTP_PORT $smtp_port $YML
79check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
80check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
81check_value DISCOURSE_SMTP_DOMAIN $smtp_domain $YML
82check_value DISCOURSE_NOTIFICATION_EMAIL $notification $YML
83echo "################################ Update of values succeeded. ###################################"
84echo "Removing $YML*"
85rm $YML*
86
87echo "Test succeeded. Removing $YML"
88rm $YML