Merge pull request #1456 from pi-hole/v6/special-env
Add special handling for FTL Config names that have underscores in them
This commit is contained in:
commit
77ee293ac0
|
@ -127,11 +127,33 @@ apply_FTL_Configs_From_Env(){
|
|||
# Replace underscores with dots in the name to match pihole-FTL expectiations
|
||||
name="${name//_/.}"
|
||||
|
||||
# Special handing for the value if the name is dns.upstreams
|
||||
if [ "$name" == "dns.upstreams" ]; then
|
||||
value='["'${value//;/\",\"}'"]'
|
||||
fi
|
||||
|
||||
# Special handling for some FTL Config values
|
||||
case "$name" in
|
||||
# Convert the semicolon separated list to a JSON array
|
||||
"dns.upstreams")
|
||||
value='["'${value//;/\",\"}'"]'
|
||||
;;
|
||||
# The following config names have an underscore in them,
|
||||
# so we need to re-convert the dot back to an underscore
|
||||
"webserver.tls.rev.proxy")
|
||||
name="webserver.tls.rev_proxy"
|
||||
;;
|
||||
"webserver.api.totp.secret")
|
||||
name="webserver.api.totp_secret"
|
||||
;;
|
||||
"webserver.api.allow.destructive")
|
||||
name="webserver.api.allow_destructive"
|
||||
;;
|
||||
"misc.delay.startup")
|
||||
name="misc.delay_startup"
|
||||
;;
|
||||
"misc.dnsmasq.lines")
|
||||
name="misc.dnsmasq_lines"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Mask the value if it is a password, else display the value as is
|
||||
if [ "$name" == "webserver.api.password" ]; then
|
||||
masked_value=$(printf "%${#value}s" | tr " " "*")
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue