mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Update ssl
This commit is contained in:
22
webtop/rootfs/etc/cont-init.d/90-ssl.sh
Normal file
22
webtop/rootfs/etc/cont-init.d/90-ssl.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
if bashio::config.true 'use_own_certs'; then
|
||||
bashio::log.green "Using referenced ssl certificates to connect with https. Please remember to open the ssl port in the addon options"
|
||||
CERTFILE="$(bashio::config 'certfile')"
|
||||
KEYFILE="$(bashio::config 'keyfile')"
|
||||
NGINX_CONFIG="/defaults/default.conf"
|
||||
|
||||
#Check if files exist
|
||||
echo "... checking if referenced files exist"
|
||||
if [ -f /ssl/"$CERTFILE" ] && [ -f /ssl/"$KEYFILE" ]; then
|
||||
# Add ssl file
|
||||
sed -i "s|/config/data/ssl/cert.pem|/ssl/$CERTFILE|g" "$NGINX_CONFIG"
|
||||
sed -i "s|/config/data/ssl/cert.key|/ssl/$KEYFILE|g" "$NGINX_CONFIG"
|
||||
echo "... done"
|
||||
else
|
||||
bashio::log.warning "... certificate /ssl/$CERTFILE and /ssl/$KEYFILE and not found, using self-generated certificates"
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -4,8 +4,9 @@ set -e
|
||||
|
||||
if bashio::config.true 'use_own_certs'; then
|
||||
bashio::log.green "Using referenced ssl certificates to connect with https. Please remember to open the ssl port in the addon options"
|
||||
CERTFILE=$(bashio::config 'certfile')
|
||||
KEYFILE=$(bashio::config 'keyfile')
|
||||
CERTFILE="$(bashio::config 'certfile')"
|
||||
KEYFILE="$(bashio::config 'keyfile')"
|
||||
NGINX_CONFIG="/defaults/default.conf"
|
||||
|
||||
#Check if files exist
|
||||
echo "... checking if referenced files exist"
|
||||
|
||||
Reference in New Issue
Block a user