mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-27 02:44:05 +02:00
config yaml improve
This commit is contained in:
@@ -73,7 +73,7 @@ while IFS= read -r line; do
|
||||
secret=${line#*secret }
|
||||
# Check if single match
|
||||
secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml)
|
||||
[[ $(echo $secretnum) == *' '* ]] && bashio::log.fatal "There are multiple matches for your password name. Please check your secrets.yaml file" && bashio::exit.nok
|
||||
[[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
|
||||
# Get text
|
||||
secret=$(sed -n "/$secret:/p" /config/secrets.yaml)
|
||||
secret=${secret#*: }
|
||||
@@ -81,20 +81,14 @@ while IFS= read -r line; do
|
||||
fi
|
||||
# Data validation
|
||||
if [[ $line =~ ^.+[=].+$ ]]; then
|
||||
export $line # Export the variable
|
||||
logmsg="Variable set : $line"
|
||||
if [ -f /etc/services.d/*/*run* ]; then
|
||||
sed -i "1a export $line" /etc/services.d/*/run # Export the variable
|
||||
sed -i "1a bashio::log.blue \"$logmsg\" || echo \"$logmsg\"" /etc/services.d/*/run # Show text in colour
|
||||
fi
|
||||
if [ -f /scripts/*run* ]; then
|
||||
sed -i "1a export $line" /scripts/*run* # Export the variable
|
||||
sed -i "1a bashio::log.blue \"$logmsg\" || echo \"$logmsg\"" /scripts/*run* # Show text in colour
|
||||
fi
|
||||
export $line
|
||||
# Export the variable
|
||||
[ -f /etc/services.d/*/*run* ] && sed -i "1a export $line" /etc/services.d/*/*run*
|
||||
[ -f /scripts/*run* ] && sed -i "1a export $line" /scripts/*run*
|
||||
# Show in log
|
||||
bashio::log.blue "$line"
|
||||
else
|
||||
bashio::log.fatal "$line does not follow the structure KEY=text"
|
||||
bashio::exit.nok
|
||||
bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file."
|
||||
fi
|
||||
done <"/tmpfile"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user