mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-06 23:55:56 +02:00
Not starting with whitespace
This commit is contained in:
@@ -144,24 +144,25 @@ while IFS= read -r line; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if secret
|
# Check if secret
|
||||||
if [[ "${line}" == *'!secret '* ]]; then
|
if [[ "$line" == *!secret* ]]; then
|
||||||
echo "secret detected"
|
echo "Secret detected"
|
||||||
if [ ! -f "$SECRETSFILE" ]; then
|
if [ ! -f "$SECRETSFILE" ]; then
|
||||||
bashio:log.fatal "Secrets file not found, ${line} skipped"
|
bashio::log.fatal "Secrets file not found in $SECRETSFILE, $line skipped"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
secret=${line#*secret }
|
secret=$(echo "$line" | sed 's/.*!secret \(.*\)/\1/')
|
||||||
# Check if single match
|
# Check if single match
|
||||||
secretnum=$(sed -n "/$secret:/=" "$SECRETSFILE")
|
secretnum=$(sed -n "/$secret:/=" "$SECRETSFILE")
|
||||||
[[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
|
if [[ $(echo "$secretnum" | grep -q ' ') ]]; then
|
||||||
# Get text
|
bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
|
||||||
secret=$(sed -n "/$secret:/p" "$SECRETSFILE")
|
fi
|
||||||
secret=${secret#*: }
|
# Get text
|
||||||
line="${line%%=*}='$secret'"
|
secret_value=$(sed -n "/$secret:/s/.*: //p" "$SECRETSFILE")
|
||||||
|
line="${line%%=*}='$secret_value'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Data validation
|
# Data validation
|
||||||
if [[ "$line" =~ ^.+[=].+$ ]]; then
|
if [[ "$line" =~ ^[^[:space:]]+.+[=].+$ ]]; then
|
||||||
# extract keys and values
|
# extract keys and values
|
||||||
KEYS="${line%%=*}"
|
KEYS="${line%%=*}"
|
||||||
VALUE="${line#*=}"
|
VALUE="${line#*=}"
|
||||||
|
|||||||
Reference in New Issue
Block a user