~mthaddon/mojo/mojo-how-to-focal

« back to all changes in this revision

Viewing changes to mojo-how-to/scripts/utils/configure-apache2-vhosts-autocert

  • Committer: Tom Haddon
  • Date: 2020-02-25 15:42:35 UTC
  • Revision ID: tom.haddon@canonical.com-20200225154235-m8hzin3ycwvi9a8t
Don't try to set the vhost config twice in devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
set -eu
4
4
 
5
5
if [ ${MOJO_STAGE##*/} != "production" ]; then
6
 
    HTTP_TEMPLATE="${MOJO_STAGE}/../configs/mojo-how-to-vhost-http.template"
7
 
else
8
 
    HTTP_TEMPLATE="${MOJO_STAGE}/../configs/mojo-how-to-production-vhost-http.template"
9
 
    HTTPS_TEMPLATE="${MOJO_STAGE}/../configs/mojo-how-to-production-vhost-https.template"
 
6
    # We've already set our vhost config, so just exit
 
7
    exit 0
10
8
fi
11
9
 
 
10
HTTP_TEMPLATE="${MOJO_STAGE}/../configs/mojo-how-to-production-vhost-http.template"
 
11
HTTPS_TEMPLATE="${MOJO_STAGE}/../configs/mojo-how-to-production-vhost-https.template"
 
12
 
12
13
JUJU_VERSION=$(juju version)
13
14
 
14
15
echo "Checking Juju version..."
29
30
    ;;
30
31
esac
31
32
 
32
 
if [ ${MOJO_STAGE##*/} != "production" ]; then
33
 
    # No need to configure autocert in devel, just set the template
34
 
    # and then exit.
35
 
    echo "Updating ${APPLICATION} vhost template..."
36
 
    ${juju_set} ${APPLICATION} \
37
 
        vhost_http_template="$(base64 -w0 < ${MOJO_SPEC_DIR}/${HTTP_TEMPLATE})"
38
 
    exit 0
39
 
fi
40
 
 
41
33
echo "Unsetting key, cert and chain for ${APPLICATION}..."
42
34
${juju_set} ${APPLICATION} ssl_cert= ssl_chain= ssl_key= || true # If the settings were already empty, this bombs out, so we don't want that to kill the script.
43
35