mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-22 01:34:00 +02:00
bashio now emits deprecation warnings for bashio::addon.* calls. This migrates all 227 call-sites across 86 files to use the new bashio::app.* API. Cross-compatibility is preserved in two ways: 1. bashio-standalone.sh: adds bashio::app.* functions that forward to bashio::addon.* (used when running without HA Supervisor). Also adds the missing ingress_url, restart and stop stubs. 2. ha_entrypoint.sh: injects a one-liner compat shim after the shebang of every cont-init and service script at container startup. On old bashio installations (bashio::app.* absent) the shim defines bashio::app.* as thin wrappers around bashio::addon.*; on new bashio the guard condition is true so the block is a no-op. The probe script in ha_entrypoint.sh is also updated to try bashio::app.version before falling back to bashio::addon.version. https://claude.ai/code/session_011FWFBhYQ6VS5FauSqv4UMo
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/with-contenv bashio
|
|
# shellcheck shell=bash
|
|
set -e
|
|
|
|
#################
|
|
# NGINX SETTING #
|
|
#################
|
|
declare port
|
|
declare certfile
|
|
declare ingress_interface
|
|
declare ingress_port
|
|
declare keyfile
|
|
|
|
port=$(bashio::app.port 80)
|
|
if bashio::var.has_value "${port}"; then
|
|
bashio::config.require.ssl
|
|
|
|
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
|
|
fi
|
|
|
|
ingress_port=$(bashio::app.ingress_port)
|
|
ingress_interface=$(bashio::app.ip_address)
|
|
ingress_entry=$(bashio::app.ingress_entry)
|
|
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
|
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
|
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf
|