From 30c19b443abf838038c8d80f300901be94f25888 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 30 Jan 2023 14:57:52 +0100 Subject: [PATCH] Error message if no config.yaml in CONFIGSOURCE --- .templates/90-config_yaml.sh | 4 ++++ enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh | 4 ++++ enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.templates/90-config_yaml.sh b/.templates/90-config_yaml.sh index ec32c431e..0b4d250f7 100755 --- a/.templates/90-config_yaml.sh +++ b/.templates/90-config_yaml.sh @@ -8,6 +8,10 @@ # Where is the config CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION") +# Check CONFIGSOURCE ends with config.yaml +if [ "$(basename "$CONFIGSOURCE")" != "config.yaml" ]; then + bashio::log.error "Watchout: your CONFIG_LOCATION should end by config.yaml, and instead it is $(basename "$CONFIGSOURCE")" +fi # Check if config is located in an acceptable location LOCATIONOK="" diff --git a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh index bb94388bb..1b1028762 100755 --- a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh +++ b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh @@ -7,6 +7,10 @@ # Where is the config CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION") +# Check CONFIGSOURCE ends with config.yaml +if [ "$(basename "$CONFIGSOURCE")" != "config.yaml" ]; then + bashio::log.error "Watchout: your CONFIG_LOCATION should end by config.yaml, and instead it is $(basename "$CONFIGSOURCE")" +fi DATABASESOURCE="$(dirname "${CONFIGSOURCE}")/cache.db" # Make sure folder exist diff --git a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh index 2b451828e..b0c47ce86 100755 --- a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh +++ b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh @@ -7,6 +7,10 @@ # Where is the config CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION") +# Check CONFIGSOURCE ends with config.yaml +if [ "$(basename "$CONFIGSOURCE")" != "config.yaml" ]; then + bashio::log.error "Watchout: your CONFIG_LOCATION should end by config.yaml, and instead it is $(basename "$CONFIGSOURCE")" +fi DATABASESOURCE="$(dirname "${CONFIGSOURCE}")/cache.db" # Make sure folder exist