mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-03 06:14:07 +02:00
Align secrets with new config logic
https://github.com/alexbelgium/hassio-addons/issues/1669 https://github.com/alexbelgium/hassio-addons/issues/1163 https://github.com/alexbelgium/hassio-addons/issues/1655
This commit is contained in:
@@ -157,6 +157,10 @@ parse_yaml "$CONFIGSOURCE" "" >/tmpfile
|
|||||||
# Escape dollars
|
# Escape dollars
|
||||||
sed -i 's|$.|\$|g' /tmpfile
|
sed -i 's|$.|\$|g' /tmpfile
|
||||||
|
|
||||||
|
# Look where secrets.yaml is located
|
||||||
|
SECRETSFILE="/config/secrets.yaml"
|
||||||
|
if [ -f "$SECRETSFILE" ]; then SECRETSFILE="/homeassistant/secrets.yaml"; fi
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
# Clean output
|
# Clean output
|
||||||
line="${line//[\"\']/}"
|
line="${line//[\"\']/}"
|
||||||
@@ -165,10 +169,10 @@ while IFS= read -r line; do
|
|||||||
echo "secret detected"
|
echo "secret detected"
|
||||||
secret=${line#*secret }
|
secret=${line#*secret }
|
||||||
# Check if single match
|
# Check if single match
|
||||||
secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml)
|
secretnum=$(sed -n "/$secret:/=" "$SECRETSFILE")
|
||||||
[[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
|
[[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
|
||||||
# Get text
|
# Get text
|
||||||
secret=$(sed -n "/$secret:/p" /config/secrets.yaml)
|
secret=$(sed -n "/$secret:/p" "$SECRETSFILE")
|
||||||
secret=${secret#*: }
|
secret=${secret#*: }
|
||||||
line="${line%%=*}='$secret'"
|
line="${line%%=*}='$secret'"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user