addon-mopidy/mopidy/rootfs/etc/cont-init.d/nginx.sh
2021-01-26 14:10:37 +01:00

27 lines
1 KiB
Bash

#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Mopidy
# Configures NGINX
# ==============================================================================
# Generate Ingress configuration
bashio::var.json \
interface "$(bashio::addon.ip_address)" \
entry "$(bashio::addon.ingress_entry)" \
| tempio \
-template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf
# Generate direct access configuration, if enabled.
if bashio::var.has_value "$(bashio::addon.port 80)"; then
bashio::config.require.ssl
bashio::var.json \
certfile "$(bashio::config 'certfile')" \
keyfile "$(bashio::config 'keyfile')" \
leave_front_door_open "^$(bashio::config 'leave_front_door_open')" \
port "^$(bashio::addon.port 80)" \
ssl "^$(bashio::config 'ssl')" \
| tempio \
-template /etc/nginx/templates/direct.gtpl \
-out /etc/nginx/servers/direct.conf
fi