mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-09 17:31:03 +01:00
23 lines
866 B
Bash
Executable File
23 lines
866 B
Bash
Executable File
#!/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
|