1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-17 21:59:55 +00:00
Commit Graph

25 Commits

Author SHA1 Message Date
Christian König
b5800ef718
Remove getFTLAPIPort() function and fix pihole status
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-05-27 11:53:00 +01:00
Adam Warner
c0e352094d
REVISIT: Remove some references to setupVars (some files can probably go entirely...)
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2023-05-27 11:51:16 +01:00
Adam Warner
7cbe713873
REVISIT: Don't rely on existence of setupVars.conf
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2023-05-27 11:51:16 +01:00
Adam Warner
2784b267ec
pihole command: read values from pihole-FTL instead of setupvars.conf
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2023-05-27 11:51:16 +01:00
Adam Warner
632aead691
add wrappers to utils.sh for setting FTL config & add tests
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2023-05-27 11:51:16 +01:00
Adam Warner
58275ecd13
Revert "Ignore commented lines when reading PRIVACYLEVEL from config file" 2023-03-22 21:52:39 +00:00
Dan Schaper
fb032ea6e7
Ignore commented lines when reading PRIVACYLEVEL from config file (#5177) 2023-03-22 12:23:40 -07:00
William Blew
3c91b6558d
restore the addKey comment, reworded for anchors
Per @dschaper, restore the addKey clarifying comment. It has
been reworded to describe the use of anchors where before it
referenced using grep's  'match only an entire line' argument.

Signed-off-by: William Blew <william@kulian.org>
2023-03-17 11:50:53 -07:00
William Blew
b9a6970bfd
Fix addKey to handle substrings of existing keys
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>
2023-03-17 11:50:52 -07:00
Christian König
4fd0f15d90
Ignore commented lines when reding PRIVACYLEVEL from config file
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>
2023-02-21 21:03:55 +01:00
Christian König
67385b7ed4
Touch files before addKey or addOrEditKeyValPair
Signed-off-by: Christian König <ckoenig@posteo.de>
2022-11-09 21:25:09 +01:00
Christian König
276c480f50
Return default port if non-numeric characters are set in pihole-FTL.conf for FTLPORT. FTL does the same in such case and provide the API on 4711
Signed-off-by: Christian König <ckoenig@posteo.de>
2022-09-26 23:40:09 +02:00
Christian König
25ba68104b Remove last traces
Signed-off-by: Christian König <ckoenig@posteo.de>
2022-09-26 22:55:34 +02:00
Christian König
3d01e4d0cf No detour - use pihole-FTL.conf to get the API port number
Signed-off-by: Christian König <ckoenig@posteo.de>
2022-09-26 22:55:30 +02:00
Christian König
7b77d991df
Move FTL port and PID functions to utils.sh
Signed-off-by: Christian König <ckoenig@posteo.de>
2022-07-26 14:38:03 +02:00
Christian König
73d5902bed
Add editorconfig-checker workflow
Add yml style to editorconfig
Add markdown styling to editorconfig

Signed-off-by: Christian König <ckoenig@posteo.de>
2022-07-02 09:36:52 +02:00
Adam Warner
d78c689e55
no more alphabetical order
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-21 19:56:21 +01:00
Adam Warner
db116971ce
I tried to do too many things in one function, vastly overcomplicating what should have been _this_ all along
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-14 22:53:38 +01:00
yubiuser
9b4f6c84cd
Minor review comments 2022-04-04 23:14:10 +02:00
Adam Warner
4d31d5ee11
Address review comments
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-04 22:02:26 +01:00
Adam Warner
7fa8cdd03e
Address:
- Review Comments
 - Stickler Complaints
2022-04-02 12:46:07 +01:00
Adam Warner
59fc3804be
Make utils.sh posix compatible per request
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-03-16 20:40:25 +00:00
Adam Warner
48138d32b6
Adjust addOrEditKeyValPair to optionally take two or three arguments (adjust test to suit)
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>
2022-03-16 17:42:01 +00:00
Christian König
42424b515b 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>
2022-02-27 18:16:53 +01:00
Adam Warner
77e5121d43
Split new function out into a separte utility script and add a test for it. Can be used in future to organise re/commonly-used code
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-01-30 23:05:28 +00:00