mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-31 09:13:33 +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
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/with-contenv bashio
|
|
# shellcheck shell=bash
|
|
set -e
|
|
|
|
###############
|
|
# SSL SETTING #
|
|
###############
|
|
declare port
|
|
declare certfile
|
|
declare keyfile
|
|
|
|
# General values
|
|
port=2342
|
|
sed -i "s|%%port%%|$port|g" /etc/nginx/servers/ssl.conf
|
|
sed -i "s|%%interface%%|$(bashio::app.ip_address)|g" /etc/nginx/servers/ssl.conf
|
|
|
|
# Ssl values
|
|
if bashio::config.true 'ssl'; then
|
|
echo "Defining ssl configuration"
|
|
bashio::config.require.ssl
|
|
certfile=$(bashio::config 'certfile')
|
|
keyfile=$(bashio::config 'keyfile')
|
|
|
|
#Check if files exist
|
|
echo "... checking if referenced certificates exist"
|
|
[ ! -f /ssl/"$certfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$certfile not found" && bashio::exit.nok
|
|
[ ! -f /ssl/"$keyfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$keyfile not found" && bashio::exit.nok
|
|
|
|
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
|
|
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
|
|
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
|
|
bashio::log.info "Ssl enabled, please use https for connection. UI is at https://YOURIP:$(bashio::app.port 2342)"
|
|
fi
|