mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-05 15:15:58 +02:00
Add secrets to config.yaml
https://github.com/m4dm4rtig4n/myelectricaldata/issues/288
This commit is contained in:
@@ -16,6 +16,18 @@ for KEYS in "${arr[@]}"; do
|
|||||||
# export key
|
# export key
|
||||||
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
|
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
|
||||||
line="${KEYS}='${VALUE//[\"\']/}'"
|
line="${KEYS}='${VALUE//[\"\']/}'"
|
||||||
|
# Check if secret
|
||||||
|
if [[ "${line}" == *'!secret '* ]]; then
|
||||||
|
echo "secret detected"
|
||||||
|
secret=${line#*secret }
|
||||||
|
# Check if single match
|
||||||
|
secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml)
|
||||||
|
[[ $(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#*: }
|
||||||
|
line="${line%%=*}='$secret'"
|
||||||
|
fi
|
||||||
# text
|
# text
|
||||||
if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then
|
if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then
|
||||||
bashio::log.blue "${KEYS}=******"
|
bashio::log.blue "${KEYS}=******"
|
||||||
|
|||||||
Reference in New Issue
Block a user