Customize Postgres Start Command To Add Custom Configuration Parameters
Is your feature request related to a problem? Please describe. In our production environment, we self-host supabase. As seen here (https://github.com/supabase/supabase/blob/b6d8e770fa753ca68650fedb2b7910db72a8ba37/docker/docker-compose.yml#L350C8-L350C8) we can customize the start command used by supabase/postgres (https://github.com/supabase/postgres). In our production environment, we set some configurations using custom start commands; example:
services:
...
db:
...
command:
- postgres
...
- -c
- custom.google_distance_matrix_api_key=${GOOGLE_DISTANCE_MATRIX_API_KEY}
As seen above, we set a custom variable custom.google_distance_matrix_api_key that docker compose is then loading from the environment. The purpose of this is to access dynamic values from directly within postgres (such as in triggers and functions within postgres). We access these variables using:
DECLARE
_api_key text := current_setting('custom.google_distance_matrix_api_key');
BEGIN
...
END;
However, this is not currently possible (to my knowledge) using the CLI.
Describe the solution you'd like
Adding custom configuration options in config.toml that could be added to the end of the start command used under the hood by the CLI. For example, this could look like (in config.toml):
[db]
# ...
custom_start_parameters = []
This would allow users to achieve what I describe above, as they could use:
[db]
# ...
custom_start_parameters = [ "-c", "custom.timeout=1500", "-c", "custom.google_distance_matrix_api_key=env(GOOGLE_DISTANCE_MATRIX_API_KEY)" ]
Describe alternatives you've considered N/A
Additional context The goal would not be to replace the under-the-hood start command entirely, only append additional start parameters to whatever is existing/required by the CLI.