From 1bbe315d3e9ce802956721dd9de6b36bd068ba81 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 9 Apr 2019 15:39:24 +0200 Subject: [PATCH] Configurator 3.1 (#563) * Add options to configurator * set chmod * Fix style * Update version --- configurator/CHANGELOG.md | 4 ++++ configurator/Dockerfile | 4 ++-- configurator/config.json | 12 +++++++++--- configurator/{ => data}/configurator.conf | 4 ++-- configurator/{ => data}/run.sh | 7 +++++++ 5 files changed, 24 insertions(+), 7 deletions(-) rename configurator/{ => data}/configurator.conf (88%) rename configurator/{ => data}/run.sh (73%) diff --git a/configurator/CHANGELOG.md b/configurator/CHANGELOG.md index d840585..b6c5ee7 100644 --- a/configurator/CHANGELOG.md +++ b/configurator/CHANGELOG.md @@ -1,9 +1,13 @@ # Changelog +## 3.1 +- Add options `dirsfirst` and `enforce_basepath` + ## 3.0 - Update Python to version 3.7 - Update Configurator to version 0.3.5 - Migrate Add-on to new Ingress +- Pin Home Assistant requirements to 0.91.1 ## 2.1 - Update python version diff --git a/configurator/Dockerfile b/configurator/Dockerfile index ac286bf..e50b001 100644 --- a/configurator/Dockerfile +++ b/configurator/Dockerfile @@ -13,7 +13,7 @@ RUN apk add --no-cache \ && pip install hass-configurator==${CONFIGURATOR_VERSION} # Copy data -COPY configurator.conf /etc/ -COPY run.sh / +COPY data/configurator.conf /etc/ +COPY data/run.sh / CMD ["/run.sh"] diff --git a/configurator/config.json b/configurator/config.json index e48e8c9..15a9da0 100644 --- a/configurator/config.json +++ b/configurator/config.json @@ -1,6 +1,6 @@ { "name": "Configurator", - "version": "3.0", + "version": "3.1", "slug": "configurator", "description": "Browser-based configuration file editor for Home Assistant.", "url": "https://home-assistant.io/addons/configurator", @@ -21,7 +21,13 @@ "ports": { "8080/tcp": null }, - "options": {}, - "schema": {}, + "options": { + "dirsfirst": false, + "enforce_basepath": false + }, + "schema": { + "dirsfirst": "bool", + "enforce_basepath": "bool" + }, "image": "homeassistant/{arch}-addon-configurator" } diff --git a/configurator/configurator.conf b/configurator/data/configurator.conf similarity index 88% rename from configurator/configurator.conf rename to configurator/data/configurator.conf index d522ec2..abc6759 100644 --- a/configurator/configurator.conf +++ b/configurator/data/configurator.conf @@ -3,7 +3,7 @@ "PORT": 80, "GIT": true, "BASEPATH": "/config", - "ENFORCE_BASEPATH": false, + "ENFORCE_BASEPATH": %%ENFORCE_BASEPATH%%, "SSL_CERTIFICATE": null, "SSL_KEY": null, "IGNORE_SSL": false, @@ -17,7 +17,7 @@ "BANNED_IPS": [], "BANLIMIT": 0, "IGNORE_PATTERN": [], - "DIRSFIRST": false, + "DIRSFIRST": %%DIRSFIRST%%, "SESAME": null, "SESAME_TOTP_SECRET": null, "VERIFY_HOSTNAME": null, diff --git a/configurator/run.sh b/configurator/data/run.sh similarity index 73% rename from configurator/run.sh rename to configurator/data/run.sh index 289b86d..ebe1e2d 100755 --- a/configurator/run.sh +++ b/configurator/data/run.sh @@ -1,15 +1,22 @@ #!/usr/bin/env bashio +set -e +DIRSFIRST=$(bashio::config 'dirsfirst') +ENFORCE_BASEPATH=$(bashio::config 'enforce_basepath') WAIT_PIDS=() # Setup and run Frontend sed -i "s/%%PORT%%/8080/g" /etc/nginx/nginx-ingress.conf sed -i "s/%%PORT_INGRESS%%/8099/g" /etc/nginx/nginx-ingress.conf + nginx -c /etc/nginx/nginx-ingress.conf & WAIT_PIDS+=($!) # Setup and run configurator sed -i "s/%%TOKEN%%/${HASSIO_TOKEN}/g" /etc/configurator.conf +sed -i "s/%%DIRSFIRST%%/${DIRSFIRST}/g" /etc/configurator.conf +sed -i "s/%%ENFORCE_BASEPATH%%/${ENFORCE_BASEPATH}/g" /etc/configurator.conf + hass-configurator /etc/configurator.conf & WAIT_PIDS+=($!)