mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
configurator: Removed direct access, simplified code, bump to 4.0 (#902)
* configurator: Removed direct access from add-on * configurator: Extended list of default ingored patterns * configurator: Simplified run.sh * configurator: Bump version to 4.0 * configurator: Use the default Ingress port
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 4.0
|
||||||
|
|
||||||
|
- Removed direct access from the add-on, making the add-on Ingress only
|
||||||
|
- Extended list of default ignored patterns
|
||||||
|
- Simplified add-on code
|
||||||
|
|
||||||
## 3.7
|
## 3.7
|
||||||
|
|
||||||
- Rename files via UI
|
- Rename files via UI
|
||||||
|
|||||||
@@ -3,18 +3,9 @@ FROM $BUILD_FROM
|
|||||||
|
|
||||||
# Setup base
|
# Setup base
|
||||||
ARG CONFIGURATOR_VERSION
|
ARG CONFIGURATOR_VERSION
|
||||||
ARG HASSIO_AUTH_VERSION
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
git \
|
git \
|
||||||
lua-resty-http \
|
|
||||||
nginx \
|
|
||||||
nginx-mod-http-lua \
|
|
||||||
openssh-client \
|
openssh-client \
|
||||||
&& git clone --depth 1 -b ${HASSIO_AUTH_VERSION} \
|
|
||||||
"https://github.com/home-assistant/hassio-auth" \
|
|
||||||
&& cp -f hassio-auth/nginx-frontend/ha-auth.lua /etc/nginx/ \
|
|
||||||
&& cp -f hassio-auth/nginx-frontend/example/nginx-ingress.conf /etc/nginx/ \
|
|
||||||
&& rm -fr /usr/src/hassio-auth \
|
|
||||||
&& pip install --no-cache-dir \
|
&& pip install --no-cache-dir \
|
||||||
hass-configurator==${CONFIGURATOR_VERSION}
|
hass-configurator==${CONFIGURATOR_VERSION}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
"i386": "homeassistant/i386-base-python:3.7"
|
"i386": "homeassistant/i386-base-python:3.7"
|
||||||
},
|
},
|
||||||
"args": {
|
"args": {
|
||||||
"CONFIGURATOR_VERSION": "0.3.7",
|
"CONFIGURATOR_VERSION": "0.3.7"
|
||||||
"HASSIO_AUTH_VERSION": "4.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "Configurator",
|
"name": "Configurator",
|
||||||
"version": "3.7",
|
"version": "4.0",
|
||||||
"slug": "configurator",
|
"slug": "configurator",
|
||||||
"description": "Browser-based configuration file editor for Home Assistant",
|
"description": "Browser-based configuration file editor for Home Assistant",
|
||||||
"url": "https://github.com/home-assistant/hassio-addons/tree/master/configurator",
|
"url": "https://github.com/home-assistant/hassio-addons/tree/master/configurator",
|
||||||
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
|
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
|
||||||
"homeassistant": "0.91.1",
|
"homeassistant": "0.91.1",
|
||||||
"startup": "application",
|
"startup": "application",
|
||||||
"webui": "http://[HOST]:[PORT:8080]",
|
|
||||||
"ingress": true,
|
"ingress": true,
|
||||||
"panel_icon": "mdi:wrench",
|
"panel_icon": "mdi:wrench",
|
||||||
"auth_api": true,
|
|
||||||
"homeassistant_api": true,
|
"homeassistant_api": true,
|
||||||
"boot": "auto",
|
"boot": "auto",
|
||||||
"map": ["backup:rw", "config:rw", "share:rw", "ssl:rw"],
|
"map": ["backup:rw", "config:rw", "share:rw", "ssl:rw"],
|
||||||
"ports": {
|
|
||||||
"8080/tcp": null
|
|
||||||
},
|
|
||||||
"options": {
|
"options": {
|
||||||
"dirsfirst": false,
|
"dirsfirst": false,
|
||||||
"enforce_basepath": false,
|
"enforce_basepath": false,
|
||||||
"ignore_pattern": ["__pycache__"],
|
"ignore_pattern": ["__pycache__", ".cloud", ".storage", "deps"],
|
||||||
"ssh_keys": []
|
"ssh_keys": []
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"LISTENIP": "127.0.0.1",
|
"LISTENIP": "0.0.0.0",
|
||||||
"PORT": 80,
|
"PORT": 8099,
|
||||||
"GIT": true,
|
"GIT": true,
|
||||||
"BASEPATH": "/config",
|
"BASEPATH": "/config",
|
||||||
"ENFORCE_BASEPATH": %%ENFORCE_BASEPATH%%,
|
"ENFORCE_BASEPATH": true,
|
||||||
"SSL_CERTIFICATE": null,
|
"SSL_CERTIFICATE": null,
|
||||||
"SSL_KEY": null,
|
"SSL_KEY": null,
|
||||||
"IGNORE_SSL": false,
|
"IGNORE_SSL": false,
|
||||||
"HASS_API": "http://hassio/homeassistant/api/",
|
"HASS_API": "http://hassio/homeassistant/api/",
|
||||||
"HASS_WS_API": null,
|
"HASS_WS_API": null,
|
||||||
"HASS_API_PASSWORD": "%%TOKEN%%",
|
"HASS_API_PASSWORD": null,
|
||||||
"USERNAME": null,
|
"USERNAME": null,
|
||||||
"PASSWORD": null,
|
"PASSWORD": null,
|
||||||
"ALLOWED_NETWORKS": [],
|
"ALLOWED_NETWORKS": ["172.30.32.2"],
|
||||||
"ALLOWED_DOMAINS": [],
|
"ALLOWED_DOMAINS": [],
|
||||||
"BANNED_IPS": [],
|
"BANNED_IPS": [],
|
||||||
"BANLIMIT": 0,
|
"BANLIMIT": 0,
|
||||||
"IGNORE_PATTERN": %%IGNORE_PATTERN%%,
|
"IGNORE_PATTERN": [],
|
||||||
"DIRSFIRST": %%DIRSFIRST%%,
|
"DIRSFIRST": false,
|
||||||
"SESAME": null,
|
"SESAME": null,
|
||||||
"SESAME_TOTP_SECRET": null,
|
"SESAME_TOTP_SECRET": null,
|
||||||
"VERIFY_HOSTNAME": null,
|
"VERIFY_HOSTNAME": null,
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ set -e
|
|||||||
|
|
||||||
DIRSFIRST=$(bashio::config 'dirsfirst')
|
DIRSFIRST=$(bashio::config 'dirsfirst')
|
||||||
ENFORCE_BASEPATH=$(bashio::config 'enforce_basepath')
|
ENFORCE_BASEPATH=$(bashio::config 'enforce_basepath')
|
||||||
IGNORE_PATTERN="$(bashio::jq "/data/options.json" ".ignore_pattern")"
|
IGNORE_PATTERN="$(bashio::config 'ignore_pattern | join(",")')"
|
||||||
WAIT_PIDS=()
|
|
||||||
|
|
||||||
# If any SSH key files are defined in the configuration options, add them for use by git
|
# If any SSH key files are defined in the configuration options, add them for use by git
|
||||||
if bashio::config.has_value "ssh_keys"; then
|
if bashio::config.has_value "ssh_keys"; then
|
||||||
@@ -14,45 +13,26 @@ if bashio::config.has_value "ssh_keys"; then
|
|||||||
|
|
||||||
# Add the keys defined in the configuration options
|
# Add the keys defined in the configuration options
|
||||||
while read -r filename; do
|
while read -r filename; do
|
||||||
if bashio::fs.file_exists "$filename"; then
|
if bashio::fs.file_exists "${filename}"; then
|
||||||
bashio::log.info "Adding SSH private key file \"$filename\""
|
bashio::log.info "Adding SSH private key file \"${filename}\""
|
||||||
ssh-add -q "$filename"
|
ssh-add -q "${filename}"
|
||||||
else
|
else
|
||||||
bashio::log.error "SSH key file \"$filename\" not found"
|
bashio::log.error "SSH key file \"${filename}\" not found"
|
||||||
fi
|
fi
|
||||||
done <<< "$(bashio::config 'ssh_keys')"
|
done <<< "$(bashio::config 'ssh_keys')"
|
||||||
|
|
||||||
# Disable strict host key checking
|
# Disable strict host key checking
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "Host *
|
{
|
||||||
StrictHostKeyChecking no" > ~/.ssh/config
|
echo "Host *"
|
||||||
|
echo " StrictHostKeyChecking no"
|
||||||
|
} > ~/.ssh/config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 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
|
# Setup and run configurator
|
||||||
sed -i "s/%%TOKEN%%/${HASSIO_TOKEN}/g" /etc/configurator.conf
|
export HC_HASS_API_PASSWORD="${HASSIO_TOKEN}"
|
||||||
sed -i "s/%%DIRSFIRST%%/${DIRSFIRST}/g" /etc/configurator.conf
|
export HC_DIRFIRST="${DIRSFIRST}"
|
||||||
sed -i "s/%%ENFORCE_BASEPATH%%/${ENFORCE_BASEPATH}/g" /etc/configurator.conf
|
export HC_ENFORECE_BASEPATH="${ENFORCE_BASEPATH}"
|
||||||
sed -i "s/%%IGNORE_PATTERN%%/${IGNORE_PATTERN}/g" /etc/configurator.conf
|
export HC_IGNORE_PATTERN="${IGNORE_PATTERN}"
|
||||||
|
|
||||||
hass-configurator /etc/configurator.conf &
|
exec hass-configurator /etc/configurator.conf
|
||||||
WAIT_PIDS+=($!)
|
|
||||||
|
|
||||||
# Register stop
|
|
||||||
function stop_addon() {
|
|
||||||
bashio::log.debug "Kill Processes..."
|
|
||||||
kill -15 "${WAIT_PIDS[@]}"
|
|
||||||
wait "${WAIT_PIDS[@]}"
|
|
||||||
bashio::log.debug "Done."
|
|
||||||
}
|
|
||||||
trap "stop_addon" SIGTERM SIGHUP
|
|
||||||
|
|
||||||
# Wait until all is done
|
|
||||||
bashio::log.info "Add-on running"
|
|
||||||
wait "${WAIT_PIDS[@]}"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user