Skip to content

Commit

Permalink
Align secrets with new config logic
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbelgium authored Dec 13, 2024
1 parent d11b09a commit 0fccd5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .templates/01-config_yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ parse_yaml "$CONFIGSOURCE" "" >/tmpfile
# Escape dollars
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
# Clean output
line="${line//[\"\']/}"
Expand All @@ -165,10 +169,10 @@ while IFS= read -r line; do
echo "secret detected"
secret=${line#*secret }
# 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"
# Get text
secret=$(sed -n "/$secret:/p" /config/secrets.yaml)
secret=$(sed -n "/$secret:/p" "$SECRETSFILE")
secret=${secret#*: }
line="${line%%=*}='$secret'"
fi
Expand Down

0 comments on commit 0fccd5e

Please sign in to comment.