We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 15bbbf0 commit 3e88073Copy full SHA for 3e88073
src/db.ts
@@ -8,18 +8,26 @@ let db: Connection | undefined;
8
export async function getDB() {
9
if (db) return db;
10
11
+ // Require ssl in production
12
+ const extra_opts =
13
+ process.env.NODE_ENV === 'production'
14
+ ? {
15
+ ssl: true,
16
+ extra: {
17
+ ssl: {
18
+ rejectUnauthorized: false,
19
+ },
20
21
+ }
22
+ : {};
23
+
24
db = await createConnection({
25
type: 'postgres',
26
url: dbUrl,
27
synchronize: true,
28
logging: false,
29
entities: [RepUser, RepGive, HelpUser],
- ssl: true,
- extra: {
- ssl: {
- rejectUnauthorized: false,
- },
30
+ ...extra_opts,
31
});
32
console.log('Connected to DB');
33
return db;
0 commit comments