From c7cad96943a25acf54f5f0107ebcd990f322e272 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sun, 28 Oct 2018 17:40:31 +0100 Subject: [PATCH] fix: [apache] detect changes of embedded cert files to force restart --- apache/lib/common | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apache/lib/common b/apache/lib/common index dde615af..f074c10a 100644 --- a/apache/lib/common +++ b/apache/lib/common @@ -1,5 +1,6 @@ # -*- mode: shell-script -*- +config_hash= apache_proxy_dir () { DOMAIN=$(relation-get domain) || { @@ -150,6 +151,7 @@ ssl_fallback_prepare() { if [ "$content" ]; then location="$(eval echo "\$__vhost_cfg_SSL_${label^^}_LOCATION")" echo "$content" | file_put "$dst$location" + config_hash=$(printf "%s\0" "$config_hash" "$label" "$content" | md5_compat) volumes="$volumes - $dst$location:$location:ro" fi @@ -314,6 +316,7 @@ apache_core_rules_add() { local conf="$1" dst="/etc/apache2/conf-enabled/$BASE_SERVICE_NAME.conf" debug "Adding core rule." echo "$conf" | file_put "$CONFIGSTORE/$BASE_SERVICE_NAME$dst" + config_hash=$(printf "%s\0" "$config_hash" "$conf" | md5_compat) config-add " $MASTER_BASE_SERVICE_NAME: volumes: @@ -514,8 +517,11 @@ EOF apache_config_hash() { debug "Adding config hash to enable recreating upon config change." - config_hash=$(find "$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled" \ - -name \*.conf -exec md5sum {} \; | md5_compat) || exit 1 + config_hash=$({ + printf "%s\0" "$config_hash" + find "$SERVICE_CONFIGSTORE/etc/apache2/sites-enabled" \ + -name \*.conf -exec md5sum {} \; + } | md5_compat) || exit 1 init-config-add " $MASTER_BASE_SERVICE_NAME: labels: