diff --git a/joal/CHANGELOG.md b/joal/CHANGELOG.md index 530a46353..5d3d1f7c9 100644 --- a/joal/CHANGELOG.md +++ b/joal/CHANGELOG.md @@ -1,4 +1,8 @@ +## 2.1.38 (05-01-2026) +- Align configuration mapping with addon_config and homeassistant_config +- Migrate legacy /homeassistant/addons_config/joal data to the addon config folder + ## 2.1.37 (23-12-2025) - Update to latest version from anthonyraymond/joal (changelog : https://github.com/anthonyraymond/joal/releases) - The Home Assistant project has deprecated support for the armv7, armhf and i386 architectures. Support wil be fully dropped in the upcoming Home Assistant 2025.12 release diff --git a/joal/config.yaml b/joal/config.yaml index b19cb2a55..1d9c7458a 100644 --- a/joal/config.yaml +++ b/joal/config.yaml @@ -6,7 +6,8 @@ hassio_api: true image: ghcr.io/alexbelgium/joal-{arch} ingress: true map: - - config:rw + - addon_config:rw + - homeassistant_config:rw name: Joal options: env_vars: [] @@ -32,4 +33,4 @@ schema: slug: joal udev: true url: https://github.com/alexbelgium/hassio-addons -version: "2.1.37" +version: "2.1.38" diff --git a/joal/rootfs/etc/cont-init.d/99-run.sh b/joal/rootfs/etc/cont-init.d/99-run.sh index 541916387..0d32ec7a7 100755 --- a/joal/rootfs/etc/cont-init.d/99-run.sh +++ b/joal/rootfs/etc/cont-init.d/99-run.sh @@ -33,15 +33,25 @@ bashio::log.info "Joal updated" # SYMLINK CONFIG # ################## +slug=joal + +# Migrate legacy config location +if [ -d "/homeassistant/addons_config/$slug" ] \ + && [ ! -f "/homeassistant/addons_config/$slug/migrated" ] \ + && [ -n "$(find "/homeassistant/addons_config/$slug" -mindepth 1 -maxdepth 1 -print -quit)" ]; then + bashio::log.info "Migrating /homeassistant/addons_config/$slug to /addon_configs/xxx-$slug" + cp -rnf /homeassistant/addons_config/"$slug"/* /config/ || true + mv /homeassistant/addons_config/"$slug" /homeassistant/addons_config/"$slug"_migrated +fi + # If config doesn't exist, create it -if [ ! -f /config/addons_config/joal/config.json ]; then +if [ ! -f /config/config.json ]; then bashio::log.info "Symlinking config files" - mkdir -p /config/addons_config/joal - cp /data/joal/config.json /config/addons_config/joal/config.json + cp /data/joal/config.json /config/config.json fi # Refresh symlink -ln -sf /config/addons_config/joal/config.json /data/joal/config.json +ln -sf /config/config.json /data/joal/config.json ############### # SET VARIABLES # @@ -63,6 +73,12 @@ UIPATH=$(bashio::config 'ui_path') #port=$(bashio::addon.port 80) ingress_port=$(bashio::addon.ingress_port) ingress_interface=$(bashio::addon.ip_address) +ui_credentials_json=$(jq -n --arg host "${host_ip}:${host_port}${ingress_url}/" \ + --arg port "${host_port}" \ + --arg pathPrefix "${UIPATH}" \ + --arg secretToken "${TOKEN}" \ + '{host:$host,port:$port,pathPrefix:$pathPrefix,secretToken:$secretToken}') +ui_credentials_encoded=$(printf '%s' "$ui_credentials_json" | jq -sRr @uri) ################# # NGINX SETTING # @@ -80,6 +96,7 @@ 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 sed -i "s/%%path%%/${UIPATH}/g" /etc/nginx/servers/ingress.conf +sed -i "s|%%ui_credentials%%|${ui_credentials_encoded}|g" /etc/nginx/servers/ingress.conf mkdir -p /var/log/nginx && touch /var/log/nginx/error.log ############### diff --git a/joal/rootfs/etc/nginx/servers/ingress.conf b/joal/rootfs/etc/nginx/servers/ingress.conf index eac43b228..06673e09f 100644 --- a/joal/rootfs/etc/nginx/servers/ingress.conf +++ b/joal/rootfs/etc/nginx/servers/ingress.conf @@ -12,7 +12,7 @@ server { proxy_connect_timeout 30m; proxy_send_timeout 30m; proxy_read_timeout 30m; - proxy_pass http://backend/%%path%%/ui/; + proxy_pass http://backend/%%path%%/ui?ui_credentials=%%ui_credentials%%; } location /:8123/ {