From 09655eeb51a79abc95b0fa12ba00739f314c74ff Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 7 Jul 2025 10:47:59 +0200 Subject: [PATCH] Check for secrets presence --- .templates/01-config_yaml.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.templates/01-config_yaml.sh b/.templates/01-config_yaml.sh index caa0c3f0b..816b84136 100644 --- a/.templates/01-config_yaml.sh +++ b/.templates/01-config_yaml.sh @@ -135,7 +135,7 @@ sed -i 's/: /=/' /tempenv # Look where secrets.yaml is located SECRETSFILE="/config/secrets.yaml" -if [ -f "$SECRETSFILE" ]; then SECRETSFILE="/homeassistant/secrets.yaml"; fi +if [ ! -f "$SECRETSFILE" ]; then SECRETSFILE="/homeassistant/secrets.yaml"; fi while IFS= read -r line; do # Skip empty lines @@ -146,6 +146,10 @@ while IFS= read -r line; do # Check if secret if [[ "${line}" == *'!secret '* ]]; then echo "secret detected" + if [ ! -f "$SECRETSFILE" ]; then + bashio:log.fatal "Secrets file not found, ${line} skipped" + continue + fi secret=${line#*secret } # Check if single match secretnum=$(sed -n "/$secret:/=" "$SECRETSFILE")