mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-31 02:10:32 +02:00
Update 90-config_yaml.sh
This commit is contained in:
@@ -7,6 +7,9 @@ set -e
|
|||||||
# INITIALIZATION #
|
# INITIALIZATION #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
|
slug="${HOSTNAME#*-}"
|
||||||
|
bashio::log.info "Load environment variables from /config/addons_config/${slug}/config.yaml if existing"
|
||||||
|
|
||||||
# Where is the config
|
# Where is the config
|
||||||
if bashio::config.has_value 'CONFIG_LOCATION'; then
|
if bashio::config.has_value 'CONFIG_LOCATION'; then
|
||||||
|
|
||||||
@@ -14,7 +17,7 @@ if bashio::config.has_value 'CONFIG_LOCATION'; then
|
|||||||
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
||||||
# Check CONFIGSOURCE ends with config.yaml
|
# Check CONFIGSOURCE ends with config.yaml
|
||||||
if [ "$(basename "$CONFIGSOURCE")" != "config.yaml" ]; then
|
if [ "$(basename "$CONFIGSOURCE")" != "config.yaml" ]; then
|
||||||
bashio::log.error "Watchout: your CONFIG_LOCATION should end by config.yaml, and instead it is $(basename "$CONFIGSOURCE")"
|
bashio::log.error "... watch-out: your CONFIG_LOCATION should end by config.yaml, and instead it is $(basename "$CONFIGSOURCE")"
|
||||||
fi
|
fi
|
||||||
# Check if config is located in an acceptable location
|
# Check if config is located in an acceptable location
|
||||||
LOCATIONOK=""
|
LOCATIONOK=""
|
||||||
@@ -25,7 +28,7 @@ if bashio::config.has_value 'CONFIG_LOCATION'; then
|
|||||||
done
|
done
|
||||||
if [ -z "$LOCATIONOK" ]; then
|
if [ -z "$LOCATIONOK" ]; then
|
||||||
CONFIGSOURCE=/config/addons_config/${HOSTNAME#*-}
|
CONFIGSOURCE=/config/addons_config/${HOSTNAME#*-}
|
||||||
bashio::log.fatal "Your CONFIG_LOCATION values can only be set in /share, /config or /data (internal to addon). It will be reset to the default location : $CONFIGSOURCE"
|
bashio::log.fatal "... watch-out : your CONFIG_LOCATION values can only be set in /share, /config or /data (internal to addon). It will be reset to the default location : $CONFIGSOURCE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -51,8 +54,7 @@ else
|
|||||||
curl -f -L -s -S "$TEMPLATESOURCE" --output "$CONFIGSOURCE"
|
curl -f -L -s -S "$TEMPLATESOURCE" --output "$CONFIGSOURCE"
|
||||||
fi
|
fi
|
||||||
# Need to restart
|
# Need to restart
|
||||||
bashio::log.fatal "Config file not found, creating a new one. Please customize the file in $CONFIGSOURCE before restarting."
|
bashio::log.warning "... config file not found, creating a new one. Please customize the file in $CONFIGSOURCE before restarting."
|
||||||
bashio::addon.stop
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Permissions
|
# Permissions
|
||||||
|
|||||||
Reference in New Issue
Block a user