Fix addKey to handle the case where a key is being added, and that key
is the leading substring of an already existing key within that file.
For example: add "server=192.168.1.1", when "server=192.168.1.178"
already exists within the /etc/dnsmasq.d/01-pihole.conf file.
Check pihole docker with PIHOLE_DNS="192.168.1.178;192.168.1.1". Its
/etc/dnsmasq/01-pihole.conf will be missing its second server= entry.
Add the test_key_addition_substr, to test addKey when
its adding a substring key of an existing key in the file.
Signed-off-by: William Blew <william@kulian.org>
Create dedicated getVal function in utils.sh as it might be useful somewhere else
Account for tailing comments and $key not being on the first line
Signed-off-by: Christian König <ckoenig@posteo.de>
Add a removeKey function with test
update webpage.sh to reference functions in utils.sh (this can likely be abstracted/refactored further)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
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>