2023-01-18 18:22:35 +01:00
|
|
|
#!/command/with-contenv bashio
|
|
|
|
# shellcheck shell=bash
|
|
|
|
# ==============================================================================
|
|
|
|
# Community Hass.io Add-ons: ESPHome
|
|
|
|
# Configures NGINX for use with ESPHome
|
|
|
|
# ==============================================================================
|
|
|
|
mkdir -p /var/log/nginx
|
|
|
|
|
2023-01-18 19:54:27 +01:00
|
|
|
# Generate Ingress configuration
|
|
|
|
bashio::var.json \
|
|
|
|
interface "$(bashio::addon.ip_address)" \
|
|
|
|
port "^$(bashio::addon.ingress_port)" \
|
|
|
|
| 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 6052)"; then
|
|
|
|
bashio::config.require.ssl
|
|
|
|
bashio::var.json \
|
|
|
|
certfile "$(bashio::config 'certfile')" \
|
|
|
|
keyfile "$(bashio::config 'keyfile')" \
|
|
|
|
ssl "^$(bashio::config 'ssl')" \
|
|
|
|
| tempio \
|
|
|
|
-template /etc/nginx/templates/direct.gtpl \
|
|
|
|
-out /etc/nginx/servers/direct.conf
|
2023-01-18 18:22:35 +01:00
|
|
|
fi
|