add wrappers to utils.sh for setting FTL config & add tests

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2023-01-14 23:11:42 +00:00
parent e3ffec5762
commit 632aead691
No known key found for this signature in database
2 changed files with 78 additions and 0 deletions

View file

@ -145,3 +145,26 @@ getFTLPID() {
FTL_PID=${FTL_PID:=-1}
echo "${FTL_PID}"
}
#######################
# returns value from FTLs config file using pihole-FTL --config
#
# Takes one argument: key
# Example getFTLConfigValue dns.piholePTR
#######################
getFTLConfigValue(){
pihole-FTL --config "${1}"
}
#######################
# sets value in FTLs config file using pihole-FTL --config
#
# Takes two arguments: key and value
# Example setFTLConfigValue dns.piholePTR PI.HOLE
#
# Note, for complex values such as dnsmasq.upstreams, you should wrap the value in single quotes:
# setFTLConfigValue dnsmasq.upstreams '[ "8.8.8.8" , "8.8.4.4" ]'
#######################
setFTLConfigValue(){
pihole-FTL --config "${1}" "${2}"
}