From 1d1f61e6b4f0e9b209f32a621aa404b73d4bcc0f Mon Sep 17 00:00:00 2001 From: Tom Wiesing Date: Wed, 3 Aug 2022 18:27:25 +0200 Subject: [PATCH] update_prefix_config: Use https when enabled This commit updates the 'update_prefix_config.sh' script to use an 'https://' as opposed to an 'http://' url when support is enabled. --- distillery/lib/30_slug.sh | 10 ++++++++++ distillery/update_prefix_config.sh | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/distillery/lib/30_slug.sh b/distillery/lib/30_slug.sh index 31bb1fe..8c6341d 100644 --- a/distillery/lib/30_slug.sh +++ b/distillery/lib/30_slug.sh @@ -43,6 +43,16 @@ function compute_instance_domain() { } INSTANCE_DOMAIN="$(compute_instance_domain "$SLUG")" +# compute the url pointing to an instance +function compute_instance_url() { + if [ -n "$CERTBOT_EMAIL" ]; then + echo -n "https://" + else + echo "http://" + fi + compute_instance_domain "$@" +} + # Next we need a username base. # This will be used as a username across the system (linux), MySQL and GraphDB. # For this we can only allow [0-9a-zA-Z-], hence we have to escape. diff --git a/distillery/update_prefix_config.sh b/distillery/update_prefix_config.sh index 20f059b..f73da21 100644 --- a/distillery/update_prefix_config.sh +++ b/distillery/update_prefix_config.sh @@ -15,7 +15,7 @@ date | tee -a "$DEPLOY_PREFIX_CONFIG" # update all the instances for slug in $(sql_bookkeep_list); do - INSTANCE_DOMAIN="http://$(compute_instance_domain "$slug")" + INSTANCE_DOMAIN="$(compute_instance_url "$slug")" echo "$INSTANCE_DOMAIN:" | tee -a "$DEPLOY_PREFIX_CONFIG" read -r INSTANCE_BASE_DIR MYSQL_DATABASE MYSQL_USER GRAPHDB_REPO GRAPHDB_USER GRAPHDB_PASSWORD <<< "$(sql_bookkeep_load "${slug}" "filesystem_base,sql_database,sql_user,graphdb_repository,graphdb_user,graphdb_password" | tail -n +2)"