diff --git a/packages/@n8n/config/src/configs/database.config.ts b/packages/@n8n/config/src/configs/database.config.ts index 9da83958e6da0..785d91b4bfd52 100644 --- a/packages/@n8n/config/src/configs/database.config.ts +++ b/packages/@n8n/config/src/configs/database.config.ts @@ -75,6 +75,10 @@ class PostgresConfig { @Env('DB_POSTGRESDB_POOL_SIZE') poolSize: number = 2; + /** Postgres connection timeout (ms) */ + @Env('DB_POSTGRESDB_CONNECTION_TIMEOUT') + connectionTimeoutMs: number = 1000; + @Nested ssl: PostgresSSLConfig; } diff --git a/packages/@n8n/config/test/config.test.ts b/packages/@n8n/config/test/config.test.ts index 149cb1abbe7f0..ecb254184a038 100644 --- a/packages/@n8n/config/test/config.test.ts +++ b/packages/@n8n/config/test/config.test.ts @@ -47,6 +47,7 @@ describe('GlobalConfig', () => { poolSize: 2, port: 5432, schema: 'public', + connectionTimeoutMs: 1000, ssl: { ca: '', cert: '', diff --git a/packages/cli/src/databases/config.ts b/packages/cli/src/databases/config.ts index 1f8c748fa7afe..9c4562d3d6652 100644 --- a/packages/cli/src/databases/config.ts +++ b/packages/cli/src/databases/config.ts @@ -104,6 +104,7 @@ const getPostgresConnectionOptions = (): PostgresConnectionOptions => { schema: postgresConfig.schema, poolSize: postgresConfig.poolSize, migrations: postgresMigrations, + connectTimeoutMS: postgresConfig.connectionTimeoutMs, ssl, }; };