Enable Config Include in default configuration #1267
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 lineinclude_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: