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

Customize pihole-FTL.conf with FTLCONF_ prefixed environment variables. #944

Merged
merged 2 commits into from
Nov 26, 2021

Conversation

AlexandreRatte
Copy link
Contributor

@AlexandreRatte AlexandreRatte commented Nov 21, 2021

Description

Parse all environment variables starting with the FTLCONF_ prefix and setup the variable's suffix as a pihole-FTL.conf customized setting. For example, setting the FTLCONF_REPLY_ADDR4=10.1.2.3 environment variable would result in a pihole-FTL.conf setting of REPLY_ADDR4=10.1.2.3.

This PR is marked as having a breaking change since the yet undocumented ServerIP and ServerIPv6 variables have been deprecated in favor of provisioning them as FTLCONF_REPLY_ADDR4 and FTLCONF_REPLY_ADDR6 respectively.

Motivation and Context

Addresses #922 and #919

There were use cases where pihole-FTL.conf could be supplied through a read-only filesystem i.e.: a Kubernetes ConfigMap, and calling the changeFTLsetting function on such a read-only file would cause the container to crash loop. This PR is meant to provide the pi-hole administrator all the flexibility that was previously associated with volume-mounting a customized pihole-FTL.conf, but now by using environment variables.

How Has This Been Tested?

  • docker run -it -e FTLCONF_REPLY_ADDR4=10.1.2.3 -e FTLCONF_MAXDBDAYS=7 issue922
  • Shelled into the running container then executed:
# cat /etc/pihole/pihole-FTL.conf
PRIVACYLEVEL=0
MAXDBDAYS=7
REPLY_ADDR4=10.1.2.3
#

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Signed-off-by: Alexandre Ratte <alexandre.ratte@gmail.com>
@PromoFaux
Copy link
Member

I've not tested this functionally, yet, but I like the idea a lot. I am wondering (out loud) if we can do something similar for setupVars.conf keypairs, so SETUPVARS_ env variables, and what this would look like.

I also need to check a few things, but we might be able to keep the ServerIP ones around so that this does not become a breaking change (although I'm all for breaking changes if they are good and sensible like this)

@AlexandreRatte
Copy link
Contributor Author

Yes, implementing something similar for setupVars.conf would probably clean things up rather nicely. However, in light of #922 causing issues to folks who are supplying pihole-FTL.conf through a read-only volume mount due to the lack of customization capabilities by other means, I would suggest attacking setupVars.conf outside of this PR.

Let me know of your thoughts, I'm happy to discuss and make amendments per your review.

Copy link
Member

@PromoFaux PromoFaux left a comment

Choose a reason for hiding this comment

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

a

start.sh Show resolved Hide resolved
…recated variables.

Signed-off-by: Alexandre Ratte <alexandre.ratte@gmail.com>
@PromoFaux PromoFaux self-requested a review November 26, 2021 16:57
@PromoFaux PromoFaux merged commit 4aaf099 into pi-hole:dev Nov 26, 2021
@AlexandreRatte AlexandreRatte deleted the Issue_922 branch November 26, 2021 17:40
sujiba added a commit to sujiba/pihole-unbound-hyperlocal that referenced this pull request Nov 27, 2021
shaderecker added a commit to shaderecker/ansible-pihole that referenced this pull request Dec 11, 2021
@scara scara mentioned this pull request Dec 27, 2021
6 tasks
sujiba added a commit to sujiba/pihole-unbound-hyperlocal that referenced this pull request May 3, 2023
sujiba added a commit to sujiba/pihole-unbound-hyperlocal that referenced this pull request May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants