mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Update 01-config_yaml.sh
This commit is contained in:
@@ -120,22 +120,17 @@ if [ ! -s /tempenv ]; then
|
||||
bashio::log.green "... no env variables found, exiting"
|
||||
exit 0
|
||||
fi
|
||||
rm /tempenv
|
||||
|
||||
# Check if yaml is valid
|
||||
EXIT_CODE=0
|
||||
yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$?
|
||||
yamllint -d relaxed /tempenv &>ERROR || EXIT_CODE=$?
|
||||
if [ "$EXIT_CODE" != 0 ]; then
|
||||
cat ERROR
|
||||
bashio::log.yellow "... config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above."
|
||||
fi
|
||||
|
||||
# Get list of parameters in a file
|
||||
cp "$CONFIGSOURCE" /tmpfile
|
||||
# Remove comments
|
||||
sed -Ei 's/\s*#.*$//' /tmpfile
|
||||
# converts yaml to variables
|
||||
sed -i 's/: /=/' /tmpfile
|
||||
sed -i 's/: /=/' /tempenv
|
||||
|
||||
# Look where secrets.yaml is located
|
||||
SECRETSFILE="/config/secrets.yaml"
|
||||
@@ -188,4 +183,5 @@ while IFS= read -r line; do
|
||||
else
|
||||
bashio::log.red "$line does not follow the correct structure. Please check your yaml file."
|
||||
fi
|
||||
done <"/tmpfile"
|
||||
done <"/tempenv"
|
||||
rm /tempenv
|
||||
|
||||
Reference in New Issue
Block a user