diff --git a/home-panel/Dockerfile b/home-panel/Dockerfile index 81da808..c0d1e42 100644 --- a/home-panel/Dockerfile +++ b/home-panel/Dockerfile @@ -13,7 +13,7 @@ RUN \ nodejs-current=9.11.1-r2 \ nginx=1.14.2-r0 \ \ - && git clone --branch "v0.4.1" --depth=1\ + && git clone --branch "v0.4.2" --depth=1\ "https://github.com/timmo001/home-panel-api.git" /opt/api \ \ && curl -J -L -o /tmp/panel.zip \ diff --git a/home-panel/rootfs/etc/cont-init.d/30-api.sh b/home-panel/rootfs/etc/cont-init.d/30-api.sh deleted file mode 100644 index 4392dde..0000000 --- a/home-panel/rootfs/etc/cont-init.d/30-api.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/with-contenv bash -# ============================================================================== -# Timmo Hass.io Add-ons: Home Panel -# This copies the api files to their respective locations -# ============================================================================== -# shellcheck disable=SC1091 -source /usr/lib/hassio-addons/base.sh - -certfile="/ssl/$(hass.config.get 'certfile')" -keyfile="/ssl/$(hass.config.get 'keyfile')" - -if hass.config.true 'ssl'; then - hass.log.info "Copy SSL certs to API directory.." - cp "$certfile" /opt/api/fullchain.pem - cp "$keyfile" /opt/api/privkey.pem -fi diff --git a/home-panel/rootfs/etc/services.d/api/run b/home-panel/rootfs/etc/services.d/api/run index c2fb662..3b5668d 100644 --- a/home-panel/rootfs/etc/services.d/api/run +++ b/home-panel/rootfs/etc/services.d/api/run @@ -11,4 +11,17 @@ hass.log.info "Run API.." # shellcheck disable=SC2164 cd /opt/api -DB_PATH=/config/home-panel.db CONFIG_PATH=/config/$(hass.config.get 'config_file') node index.js +DB_PATH=/config/home-panel.db +CONFIG_PATH=/config/$(hass.config.get 'config_file') + +if hass.config.true 'ssl'; then + SSL_PATH_CERT="/ssl/$(hass.config.get 'certfile')" + SSL_PATH_KEY="/ssl/$(hass.config.get 'keyfile')" +fi + +export DB_PATH +export CONFIG_PATH +export SSL_PATH_CERT +export SSL_PATH_KEY + +exec node index.js