2019-03-17 20:41:07 +01:00
|
|
|
#!/usr/bin/with-contenv bashio
|
2019-02-13 16:54:02 +01:00
|
|
|
# ==============================================================================
|
|
|
|
# Community Hass.io Add-ons: ESPHome
|
|
|
|
# Configures NGINX for use with ESPHome
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
declare certfile
|
|
|
|
declare keyfile
|
|
|
|
declare port
|
|
|
|
|
|
|
|
mkdir -p /var/log/nginx
|
|
|
|
|
|
|
|
# Enable SSL
|
2019-03-17 20:41:07 +01:00
|
|
|
if bashio::config.true 'ssl'; then
|
2019-02-13 16:54:02 +01:00
|
|
|
rm /etc/nginx/nginx.conf
|
|
|
|
mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf
|
|
|
|
|
2019-03-17 20:41:07 +01:00
|
|
|
certfile=$(bashio::config 'certfile')
|
|
|
|
keyfile=$(bashio::config 'keyfile')
|
2019-02-13 16:54:02 +01:00
|
|
|
|
|
|
|
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx.conf
|
|
|
|
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx.conf
|
|
|
|
fi
|
|
|
|
|
2019-03-17 20:41:07 +01:00
|
|
|
port=$(bashio::config 'port')
|
2019-02-13 16:54:02 +01:00
|
|
|
sed -i "s/%%port%%/${port}/g" /etc/nginx/nginx.conf
|