Skip to content

Commit fe8b173

Browse files
authored
Use environment PGDATABASE as the default create node --dbname. (#956)
When creating a node the option --dbname can be used to create a database for the application. When using Citus, that database is where pg_autoctl installs the Citus extensions, which is recommanded to be installed in a single database in your Postgres cluster. To ease using pg_autoctl docker-compose and kubernetes, use PGDATABASE as the default value for the --dbname option, when set in the environment.
1 parent 20c1264 commit fe8b173

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/bin/pg_autoctl/cli_common.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,15 @@ bool
959959
cli_common_getenv_pgsetup(PostgresSetup *pgSetup,
960960
SSLCommandLineOptions *sslCommandLineOptions)
961961
{
962+
if (env_exists("PGDATABASE"))
963+
{
964+
if (!get_env_copy("PGDATABASE", pgSetup->dbname, sizeof(pgSetup->dbname)))
965+
{
966+
/* errors have already been logged */
967+
exit(EXIT_CODE_BAD_ARGS);
968+
}
969+
}
970+
962971
if (env_exists(PG_AUTOCTL_SSL_SELF_SIGNED))
963972
{
964973
char selfSigned[BUFSIZE] = { 0 };

0 commit comments

Comments
 (0)