enhancement: Easier configuration of the postgres command#9629
Conversation
|
Slightly related to #938 |
|
I would also love a way to do this via the JDBC URL. The 'best' option I've come up with so far is a new The URL could look something like this, for example: |
|
@richardfearn Thanks for posting an alternative option for others. |
|
Thanks for your contribution, @KyleAure. I think would be nice to add this to the GenericContainer instead. So, every implementation get benefit of it. @richardfearn for more complex scenarios it is recommended to move from Testcontainers JDBC URL to PostgreSQLContainers. |
I believe that the GenericContainer already has an option for this which would be I don't know how much value other containers would have for such a method, and any container that would want that functionality would still need to itself define the default command, and any default options. |
|
What I meant by that, is to have a way to override or extend the existing command. Otherwise we will need to do those exceptions for every module that defines already a command. This is on the list of issues to address soon. |
Currently, the PostgreSQLContainer configures
fync=offduring initialization of the container class.This setting can be accidentally overwritten by using the
withCommand()orsetCommand()methods.It would be more extensible to keep a list of configuration options for the postgres command, and instead configure a command during the configure lifecycle step.
Opening this PR because this is how I use the PostgreSQL container and thought maybe others might find this useful.
If there is no interest feel free to close this PR.