mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
Update to Configurator 0.3.1 (#357)
* Update to configurator 0.3.1 * Fix tests * Forgot SSL * Update config.json * Update run.sh * Update run.sh * Update run.sh * Update config.json * Update run.sh * Removed verify_hostname option * Update config.json * Update run.sh * Update build.json * Update Dockerfile * Update Dockerfile
This commit is contained in:
committed by
Pascal Vizeli
parent
d20a2dedc6
commit
07f7634e94
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## 0.5
|
||||
- Added basic git stash functionality
|
||||
- Added NOTIFY_SERVICE option
|
||||
- Notifying if used passwords are insecure and when SESAME has been used
|
||||
- PASSWORD can optionally be provided as SHA256 hash
|
||||
- Added SESAME_TOTP_SECRET for TOTP based IP whitelisting
|
||||
- Added git diff functionality
|
||||
- Red colored menu button as indicator for outdated version
|
||||
- Removed right dragging area for editor settings
|
||||
- Added IGNORE_SSL option to disable SSL verification when connecting to HASS API
|
||||
- Allow customizing loglevel
|
||||
- Show client IP address in network status modal
|
||||
|
||||
## 0.4
|
||||
- Update Configurator to version 0.2.9
|
||||
- Material Icons and HASS-help now open in new tab instead of modal
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
ARG BUILD_FROM
|
||||
FROM $BUILD_FROM
|
||||
|
||||
# Add env
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
# Setup base
|
||||
ARG CONFIGURATOR_VERSION
|
||||
RUN apk add --no-cache python3 git curl \
|
||||
&& pip3 install GitPython \
|
||||
RUN apk add --no-cache git curl openssh \
|
||||
&& pip3 install --no-cache-dir GitPython pyotp \
|
||||
&& curl -s -o /configurator.py https://raw.githubusercontent.com/danielperna84/hass-configurator/$CONFIGURATOR_VERSION/configurator.py \
|
||||
&& sed -i "s/GIT = False/GIT = True/g" /configurator.py \
|
||||
&& apk del curl
|
||||
|
||||
# Copy data
|
||||
COPY map.py run.sh /
|
||||
COPY run.sh /
|
||||
RUN chmod a+x /run.sh
|
||||
|
||||
CMD ["/run.sh"]
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"build_from": {
|
||||
"amd64": "homeassistant/amd64-base-python:3.6",
|
||||
"i386": "homeassistant/i386-base-python:3.6",
|
||||
"armhf": "homeassistant/armhf-base-python:3.6",
|
||||
"aarch64": "homeassistant/aarch64-base-python:3.6"
|
||||
},
|
||||
"args": {
|
||||
"CONFIGURATOR_VERSION": "0.2.9"
|
||||
"CONFIGURATOR_VERSION": "0.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Configurator",
|
||||
"version": "0.4",
|
||||
"version": "1.0",
|
||||
"slug": "configurator",
|
||||
"description": "Browser-based configuration file editor for Home Assistant.",
|
||||
"url": "https://home-assistant.io/addons/configurator",
|
||||
@@ -15,29 +15,33 @@
|
||||
"options": {
|
||||
"username": "admin",
|
||||
"password": null,
|
||||
"ssl": false,
|
||||
"certfile": "fullchain.pem",
|
||||
"keyfile": "privkey.pem",
|
||||
"ssl": false,
|
||||
"allowed_networks": ["192.168.0.0/16", "172.30.0.0/16"],
|
||||
"banned_ips": ["8.8.8.8"],
|
||||
"banlimit": 0,
|
||||
"ignore_pattern": ["__pycache__"],
|
||||
"dirsfirst": false,
|
||||
"enforce_basepath": false
|
||||
"enforce_basepath": false,
|
||||
"notify_service": "persistent_notification.create"
|
||||
},
|
||||
"schema": {
|
||||
"username": "str",
|
||||
"password": "match(.+)",
|
||||
"ssl": "bool",
|
||||
"certfile": "str",
|
||||
"keyfile": "str",
|
||||
"ssl": "bool",
|
||||
"allowed_networks": ["str"],
|
||||
"banned_ips": ["str"],
|
||||
"banlimit": "int",
|
||||
"ignore_pattern": ["str"],
|
||||
"dirsfirst": "bool",
|
||||
"enforce_basepath": "bool",
|
||||
"notify_service": "str",
|
||||
"sesame": "str?",
|
||||
"sesame_totp_secret": "str?",
|
||||
"loglevel": "str?",
|
||||
"verify_hostname": "str?"
|
||||
},
|
||||
"image": "homeassistant/{arch}-addon-configurator"
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
"""Mapping hass.io options.json into configurator config."""
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
hassio_options = Path("/data/options.json")
|
||||
|
||||
# Read hass.io options
|
||||
with hassio_options.open('r') as json_file:
|
||||
options = json.loads(json_file.read())
|
||||
|
||||
configurator = {
|
||||
'BASEPATH': "/config",
|
||||
'ENFORCE_BASEPATH': options['enforce_basepath'],
|
||||
'HASS_API': "http://hassio/homeassistant/api/",
|
||||
'HASS_API_PASSWORD': os.environ.get('HASSIO_TOKEN', ''),
|
||||
'CREDENTIALS':
|
||||
"{}:{}".format(options['username'], options['password']),
|
||||
'SSL_CERTIFICATE':
|
||||
"ssl/{}".format(options['certfile']) if options['ssl'] else None,
|
||||
'SSL_KEY':
|
||||
"ssl/{}".format(options['keyfile']) if options['ssl'] else None,
|
||||
'ALLOWED_NETWORKS': options['allowed_networks'],
|
||||
'BANNED_IPS': options['banned_ips'],
|
||||
'IGNORE_PATTERN': options['ignore_pattern'],
|
||||
'BANLIMIT': options['banlimit'],
|
||||
'DIRSFIRST': options['dirsfirst'],
|
||||
'SESAME': options.get('sesame'),
|
||||
'VERIFY_HOSTNAME': options.get('verify_hostname'),
|
||||
}
|
||||
|
||||
with Path(sys.argv[1]).open('w') as json_file:
|
||||
json_file.write(json.dumps(configurator))
|
||||
@@ -1,8 +1,46 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
# shellcheck disable=SC2155
|
||||
|
||||
# Map hassio value into hass-configurator options
|
||||
python3 /map.py /tmp/configurator.json
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
export HC_BASEPATH=/config
|
||||
export HC_HASS_API=http://hassio/homeassistant/api/
|
||||
export HC_HASS_API_PASSWORD=$HASSIO_TOKEN
|
||||
export HC_GIT=true
|
||||
export HC_VERIFY_HOSTNAME=false
|
||||
export HC_IGNORE_SSL=false
|
||||
|
||||
export HC_ENFORCE_BASEPATH=$(jq --raw-output '.enforce_basepath' $CONFIG_PATH)
|
||||
export HC_USERNAME=$(jq --raw-output '.username' $CONFIG_PATH)
|
||||
export HC_PASSWORD=$(jq --raw-output '.password' $CONFIG_PATH)
|
||||
export HC_NOTIFY_SERVICE=$(jq --raw-output '.notify_service' $CONFIG_PATH)
|
||||
export HC_ALLOWED_NETWORKS=$(jq --raw-output '.allowed_networks | join(",")' $CONFIG_PATH)
|
||||
export HC_BANNED_IPS=$(jq --raw-output '.banned_ips | join(",")' $CONFIG_PATH)
|
||||
export HC_BANLIMIT=$(jq --raw-output '.banlimit' $CONFIG_PATH)
|
||||
export HC_IGNORE_PATTERN=$(jq --raw-output '.ignore_pattern | join(",")' $CONFIG_PATH)
|
||||
export HC_DIRSFIRST=$(jq --raw-output '.dirsfirst' $CONFIG_PATH)
|
||||
export HC_VERIFY_HOSTNAME=$(jq --raw-output '.verify_hostname // empty' $CONFIG_PATH)
|
||||
|
||||
SSL=$(jq --raw-output '.ssl // false' $CONFIG_PATH)
|
||||
if [ "$SSL" == "true" ]; then
|
||||
export HC_SSL_CERTIFICATE=$(jq --raw-output '.certfile' $CONFIG_PATH)
|
||||
export HC_SSL_KEY=$(jq --raw-output '.keyfile' $CONFIG_PATH)
|
||||
fi
|
||||
|
||||
LOGLEVEL=$(jq --raw-output '.loglevel // empty' $CONFIG_PATH)
|
||||
if [ ! -z "$LOGLEVEL" ]; then
|
||||
export HC_LOGLEVEL=$LOGLEVEL
|
||||
fi
|
||||
|
||||
SESAME=$(jq --raw-output '.sesame // empty' $CONFIG_PATH)
|
||||
if [ ! -z "$SESAME" ]; then
|
||||
export HC_SESAME=$SESAME
|
||||
fi
|
||||
|
||||
SESAME_TOTP_SECRET=$(jq --raw-output '.sesame_totp_secret // empty' $CONFIG_PATH)
|
||||
if [ ! -z "$SESAME_TOTP_SECRET" ]; then
|
||||
export HC_SESAME_TOTP_SECRET=$SESAME_TOTP_SECRET
|
||||
fi
|
||||
|
||||
# Run configurator
|
||||
exec python3 /configurator.py /tmp/configurator.json
|
||||
exec python3 /configurator.py
|
||||
|
||||
Reference in New Issue
Block a user