From 03415433e35046d91a7881c2de5e59469aca4820 Mon Sep 17 00:00:00 2001 From: Timmo Date: Sat, 6 Oct 2018 17:41:34 +0100 Subject: [PATCH] :hammer: reorder init files --- home-panel/rootfs/etc/cont-init.d/40-nginx.sh | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 home-panel/rootfs/etc/cont-init.d/40-nginx.sh diff --git a/home-panel/rootfs/etc/cont-init.d/40-nginx.sh b/home-panel/rootfs/etc/cont-init.d/40-nginx.sh new file mode 100644 index 0000000..5932bdb --- /dev/null +++ b/home-panel/rootfs/etc/cont-init.d/40-nginx.sh @@ -0,0 +1,38 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Timmo Hass.io Add-ons: Home Panel +# This copies the nginx configs to their respective locations +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +certfile="/ssl/$(hass.config.get 'certfile')" +keyfile="/ssl/$(hass.config.get 'keyfile')" + +if hass.config.true 'ssl'; then + hass.log.info "Copy enabled SSL nginx config" + echo "server { + listen 8234 ssl http2 default_server; + listen [::]:8234 ssl http2 default_server; + root /usr/share/nginx/html; + index index.html; + server_name 172.0.0.1; + ssl_certificate ${certfile}; + ssl_certificate_key ${keyfile}; + location / { + try_files \$uri /index.html; + } + }" > /etc/nginx/conf.d/default.conf; +else + hass.log.info "Copy disabled SSL nginx config" + echo "server { + listen 8234 default_server; + listen [::]:8234 default_server; + root /usr/share/nginx/html; + index index.html; + server_name 172.0.0.1; + location / { + try_files \$uri /index.html; + } + }" > /etc/nginx/conf.d/default.conf; +fi