postgresqlTestHook: add postgresqlExtraSettings variable

Add `postgresqlExtraSettings` to allow to setup the `postgresql.conf`.
This would be useful in cases where we need to set
`shared_preload_libraries`.
This commit is contained in:
Mario Rodas 2024-01-22 04:20:00 +00:00
parent 694767ccd2
commit 70b51d8d17
2 changed files with 3 additions and 0 deletions

View file

@ -45,6 +45,7 @@ Bash-only variables:
- `postgresqlTestSetupCommands`: bash commands to run after database start, defaults to running `$postgresqlTestSetupSQL` as database administrator. - `postgresqlTestSetupCommands`: bash commands to run after database start, defaults to running `$postgresqlTestSetupSQL` as database administrator.
- `postgresqlEnableTCP`: set to `1` to enable TCP listening. Flaky; not recommended. - `postgresqlEnableTCP`: set to `1` to enable TCP listening. Flaky; not recommended.
- `postgresqlStartCommands`: defaults to `pg_ctl start`. - `postgresqlStartCommands`: defaults to `pg_ctl start`.
- `postgresqlExtraSettings`: Additional configuration to add to `postgresql.conf`
## Hooks {#sec-postgresqlTestHook-hooks} ## Hooks {#sec-postgresqlTestHook-hooks}

View file

@ -56,6 +56,8 @@ EOF
echo 'initializing postgresql' echo 'initializing postgresql'
initdb -U postgres initdb -U postgres
echo "$postgresqlExtraSettings" >>"$PGDATA/postgresql.conf"
# Move the socket # Move the socket
echo "unix_socket_directories = '$NIX_BUILD_TOP/run/postgresql'" >>"$PGDATA/postgresql.conf" echo "unix_socket_directories = '$NIX_BUILD_TOP/run/postgresql'" >>"$PGDATA/postgresql.conf"