From e47bfd799866eedb72624b76b0768c6e719b4a95 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 26 Oct 2021 23:24:59 +0200 Subject: [PATCH] Update 29-ssl_config --- nextcloud/root/etc/cont-init.d/29-ssl_config | 26 +++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/nextcloud/root/etc/cont-init.d/29-ssl_config b/nextcloud/root/etc/cont-init.d/29-ssl_config index 3d8c1c4d9..0fffe5b32 100644 --- a/nextcloud/root/etc/cont-init.d/29-ssl_config +++ b/nextcloud/root/etc/cont-init.d/29-ssl_config @@ -11,14 +11,28 @@ if bashio::config.true 'use_own_certs'; then [ ! -f /ssl/$KEYFILE ] && bashio::log.fatal "... Certificate /ssl/$KEYFILE not found" && exit 1 #Sets certificates - LINE=$(sed -n '/cert.crt/=' /defaults/default) - sed -i "$LINE a ssl_certificate ${CERTFILE};" /defaults/default - sed -i "$LINE d" /defaults/default +NGINXFILE="/defaults/default" + LINE=$(sed -n '/cert.crt/=' $NGINXFILE) + sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE + sed -i "$LINE d" $NGINXFILE - LINE=$(sed -n '/cert.key/=' /defaults/default) - sed -i "$LINE a ssl_certificate_key ${CERTFILE};" /defaults/default - sed -i "$LINE d" /defaults/default + LINE=$(sed -n '/cert.key/=' $NGINXFILE) + sed -i "$LINE a ssl_certificate_key ${CERTFILE};" $NGINXFILE + sed -i "$LINE d" $NGINXFILE + #Sets certificates +NGINXFILE="/config/nginx/site-confs/default" +if [ -f $NGINXFILE ]; then + LINE=$(sed -n '/cert.crt/=' $NGINXFILE) + sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE + sed -i "$LINE d" $NGINXFILE +fi + +if [ -f $NGINXFILE ]; then + LINE=$(sed -n '/cert.key/=' $NGINXFILE) + sed -i "$LINE a ssl_certificate_key ${CERTFILE};" $NGINXFILE + sed -i "$LINE d" $NGINXFILE +fi bashio::log.info "... done" rm /etc/cont-init.d/30-keygen else