Add getFTLAPIPort function
Add ftl_api_port function Signed-off-by: Christian König <ckoenig@posteo.de> Use getFTLAPIPort in pihole Signed-off-by: Christian König <ckoenig@posteo.de> Use default portfile as fallback Signed-off-by: Christian König <ckoenig@posteo.de> Fix stickler Signed-off-by: Christian König <ckoenig@posteo.de> Correct variables Signed-off-by: Christian König <ckoenig@posteo.de> Apply suggestions from code review Co-authored-by: DL6ER <DL6ER@users.noreply.github.com> Add test getFTLAPIPort returing default port Signed-off-by: Christian König <ckoenig@posteo.de> Remove unused code from test_key_val_replacement_works Signed-off-by: Christian König <ckoenig@posteo.de> Add getFTLAPIPort_custom test Signed-off-by: Christian König <ckoenig@posteo.de> Fix output format Signed-off-by: Christian König <ckoenig@posteo.de> Add debugging Signed-off-by: Christian König <ckoenig@posteo.de> Remove debugging and fix function Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
7
pihole
7
pihole
@@ -316,9 +316,10 @@ analyze_ports() {
|
||||
|
||||
statusFunc() {
|
||||
# Determine if there is pihole-FTL service is listening
|
||||
local listening pid port
|
||||
local pid port ftl_api_port
|
||||
|
||||
pid="$(getFTLPID)"
|
||||
ftl_api_port="$(getFTLAPIPort)"
|
||||
if [[ "$pid" -eq "-1" ]]; then
|
||||
case "${1}" in
|
||||
"web") echo "-1";;
|
||||
@@ -326,8 +327,8 @@ statusFunc() {
|
||||
esac
|
||||
return 0
|
||||
else
|
||||
#get the port pihole-FTL is listening on by using FTL's telnet API
|
||||
port="$(echo ">dns-port >quit" | nc 127.0.0.1 4711)"
|
||||
#get the DNS port pihole-FTL is listening on by using FTL's telnet API
|
||||
port="$(echo ">dns-port >quit" | nc 127.0.0.1 "$ftl_api_port")"
|
||||
if [[ "${port}" == "0" ]]; then
|
||||
case "${1}" in
|
||||
"web") echo "-1";;
|
||||
|
Reference in New Issue
Block a user