Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(database): add SSL support for runtime PostgreSQL TypeORM connection (#205)

farrasyakilac463abaf321e
diff --git a/src/app.module.ts b/src/app.module.ts
index ca4a704fb..81810e3f3 100644
--- a/src/app.module.ts
+++ b/src/app.module.ts
@@ -85,6 +85,13 @@ if (process.env.QUEUE_ENABLED === 'true') {
username: configService.get<string>('dataDatabase.username'),
password: configService.get<string>('dataDatabase.password'),
database: 'openwa',
+
+ ssl: configService.get<boolean>('dataDatabase.ssl', false)
+ ? {
+ rejectUnauthorized: configService.get<boolean>('dataDatabase.sslRejectUnauthorized', true),
+ }
+ : false,
+
// Never auto-sync Postgres in production; rely on migrations.
synchronize: configService.get<boolean>('dataDatabase.synchronize', false),
migrationsRun: true,