Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get API port from pihole-FTL.conf instead of port file #260

Merged
merged 1 commit into from Oct 1, 2022

Conversation

yubiuser
Copy link
Member

What does this PR aim to accomplish?:

We removed the pihole-FTL.port file here: pi-hole/FTL#1445.
The file was used by PADD to get the current API port to communicate with FTL.
With this PR PADD now tries to read the port from pihole-FTL.conf the same as we do it in pi-hole/pi-hole#4945


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

  • I have read the above and my PR is ready for review. Check this box to confirm

Signed-off-by: Christian König <ckoenig@posteo.de>

if [ -s "$FTLCONFFILE" ]; then
# if FTLPORT is not set in pihole-FTL.conf, use the default port
ftl_api_port="$({ grep '^FTLPORT=' "${FTLCONFFILE}" || echo "${DEFAULT_FTL_PORT}"; } | cut -d'=' -f2-)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gut feeling says there is a better way than piping echo to cut but that may involve sed/awk and that's not something to wish upon a friend!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the same code in a few places in core. The echo pipe could be circumvented with something like

ftl_api_port="$(grep '^FTLPORT=' "${FTLCONFFILE}" | cut -d'=' -f2-)"

if [ -z  "${ftl_api_port}" ]; then
  ftl_api_port="${DEFAULT_FTL_PORT}"
fi

@yubiuser yubiuser merged commit 4bff926 into development Oct 1, 2022
@yubiuser yubiuser deleted the no_port branch October 1, 2022 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants