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