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

Enable Config Include in default configuration #1267

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kohlerdominik
Copy link

@kohlerdominik kohlerdominik commented Aug 15, 2024

Yesterday, I was debugging a query in our application (with docker compose) and tried to enable some logs. A common pattern for this is to load a config file to some directory, that leaves default config intact but adds some parameters (I use Nginx and PHP containers, for example). So, I was very surprised that enabling some parameters is so hard to do with the Postgres image: it's required to maintain your own config fork, and then it's also required to change the default command?!


I did quick research, and learned, that Postgres also can include files of a directory as additional config. Therefore I created this PR to enable a similar experience in this container as well.

I implemented it in a similar way to what is already used to configure the listen_addresses. With this change, it might not be needed to do it that way and we could as well just use a default configuration. I’m up for both, just let me know if I should implement it differently.

Basically, all this PR does is add the creation of the directory /etc/postgresql/conf.d and insert the line include_dir = 'etc/postgresql/conf.d' into the default config.


With the suggested changes, it would be way easier to maintain and load one or even multiple config files, especially in local docker compose environments:
For example:

services:
  pg_configdir:
    image: postgres
    volumes:
     - db:/var/lib/postgresql/data
     - ${PWD}/config/postgresql/local/:/etc/postgresql/conf.d

  pg_configfiles:
    image: postgres
    volumes:
     - db:/var/lib/postgresql/data
     - ${PWD}/config/postgresql/local/default.conf:/etc/postgresql/conf.d/10-default.conf
     # - ${PWD}/config/postgresql/local/debug.conf:/etc/postgresql/conf.d/99-debug.conf   #optional: enable only for debugging

@tianon
Copy link
Member

tianon commented Aug 15, 2024

See #835

@kohlerdominik
Copy link
Author

kohlerdominik commented Aug 15, 2024

Thanks @tianon

Great to see that I'm not the only one requesting this. Looks like this a missing feature requested by quite a few people.

@tianon
Copy link
Member

tianon commented Aug 15, 2024

Sorry, let me be more clear: I think #835 (comment) still accurately represents our shared maintainer position on this 🙈

@kohlerdominik
Copy link
Author

Thanks. I didn't see any arguments against it and interpreted the comment just as quick workaround.

Obviously, you as maintainers have the say in this. Do you mind to share what the reasons are to decline this community request?

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