V6 - Don't reintroduce comments into pihole.toml if user has removed them

I have just spun up a couple of instances of v6 and have noticed something slightly annoying. I have taken the pihole.toml file and made the required changes to it and then uploaded it to the server. As part of this change, I removed all the comments (they are useful when starting out but when you have it configured, they just add too much bulk to the file). When I then restart the FTL service, the config file is then overwritten with the same config but all the comments added back in. Now this is slightly annoying because I store the config in git which then causes issues when I want to pull any changes. Would it be possible to have some sort of setting that disables adding all the comments back in?

Just to make this clear: The entire config file is always rewritten, the comments are not selectively re-added. While we are writing the new file, we also add comments about the default values if you changed something.

Why do you want the comments to be removed? I'm asking because I cannot really follow the argument

as the comments will always be the same and should not cause any issues if you commit them in, too. I would argue on the contrary that adding the comments will possibly cause merge conflicts when the comments change. This seems useful as it requires you to look at the setting as its meaning / interpretation in edge-cases, etc. may have changed.

All that said, I am absolutely not against adding an opt-in setting. Given the number of settings in pihole.toml, it seems we are never afraid adding more settings - when this make sense. So now we are discussing one to to suppress writing the config comments. But altogether? Should this also suppress the #CHANGED, default = ... comment? Like we have in

  # Array of upstream DNS servers used by Pi-hole
  # Example: [ "", "", "docker-resolver" ]
  # Possible values are:
  #     array of IP addresses and/or hostnames, optionally with a port (#...)
  upstreams = [
  ] ### CHANGED, default = []

A simple boolean seems better than a multi-select option making this needlessly complicated.

The issue is I have already removed the comments from the config file and as such when I come to pull the changes to the servers, I get this warning from git:

error: Your local changes to the following files would be overwritten by merge:
Please commit your changes or stash them before you merge.

To fix this I then have to stop FTL, run git reset HEAD --hard, then pull the changes then restart FTL, which admittedly is minor just slightly annoying.

I think this is probably where I find the issues. Ideally I would quite like it so that I have the option to have a config file not be touched (I know that this would mean that all the web settings wouldn't work) or at least it doesn't touch any changes I have made, such as whitespace, comments, order of settings and so on.

I think possibly my overall point here is (an I have probably explained this rather poorly so I do apologise) that I would like Pi-hole to look at the data within the file, not how it is formatted, and only to change the data in the file and not the formatting. I.e. it doesn't care that I add an extra line here or there, or move some stuff around so long as all the data is still present. That way any changes to the file are expected (i.e. I made them through the web interface) and not unexpected (it decided to reformat the file).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.