mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 08:28:12 +01:00
5e5b9f2205
* Hass.io ingress * Update * Remove global vars * Fix * Fixes * Fixes * Upgrade base image to 1.5.1 * Lint
34 lines
1.2 KiB
Bash
Executable file
34 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/with-contenv bashio
|
|
# ==============================================================================
|
|
# Community Hass.io Add-ons: ESPHome
|
|
# Configures NGINX for use with ESPHome
|
|
# ==============================================================================
|
|
|
|
declare certfile
|
|
declare keyfile
|
|
declare direct_port
|
|
declare ingress_interface
|
|
declare ingress_port
|
|
|
|
mkdir -p /var/log/nginx
|
|
|
|
direct_port=$(bashio::addon.port 6052)
|
|
if bashio::var.has_value "${direct_port}"; then
|
|
if bashio::config.true 'ssl'; then
|
|
certfile=$(bashio::config 'certfile')
|
|
keyfile=$(bashio::config 'keyfile')
|
|
|
|
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
|
|
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
|
|
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
|
|
else
|
|
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
|
|
fi
|
|
|
|
sed -i "s/%%port%%/${direct_port}/g" /etc/nginx/servers/direct.conf
|
|
fi
|
|
|
|
ingress_port=$(bashio::addon.ingress_port)
|
|
ingress_interface=$(bashio::addon.ip_address)
|
|
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
|
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|