Skip to content

Commit 46912ab

Browse files
authored
chore: add DB_CA_CERT option to postgres db connections for SSL (#414)
1 parent e4d2d47 commit 46912ab

File tree

8 files changed

+48
-0
lines changed

8 files changed

+48
-0
lines changed

infrastructure/evault-core/src/config/database.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ export const AppDataSource = new DataSource({
1515
migrations: [join(__dirname, "../migrations/*.{ts,js}")],
1616
migrationsTableName: "migrations",
1717
subscribers: [],
18+
ssl: process.env.DB_CA_CERT
19+
? {
20+
rejectUnauthorized: false,
21+
ca: process.env.DB_CA_CERT,
22+
}
23+
: false,
1824
})

infrastructure/evault-core/src/core/provisioning/config/database.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@ export const ProvisioningDataSource = new DataSource({
1515
migrations: [],
1616
migrationsTableName: "migrations",
1717
subscribers: [],
18+
ssl: process.env.DB_CA_CERT
19+
? {
20+
rejectUnauthorized: false,
21+
ca: process.env.DB_CA_CERT,
22+
}
23+
: false,
1824
});
1925

platforms/cerberus/src/database/data-source.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,11 @@ export const AppDataSource = new DataSource({
2828
],
2929
migrations: [path.join(__dirname, "migrations", "*.ts")],
3030
subscribers: [PostgresSubscriber],
31+
ssl: process.env.DB_CA_CERT
32+
? {
33+
rejectUnauthorized: false,
34+
ca: process.env.DB_CA_CERT,
35+
}
36+
: false,
3137
});
3238

platforms/dreamsync-api/src/database/data-source.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export const dataSourceOptions: DataSourceOptions = {
2424
migrations: [path.join(__dirname, "migrations", "*.ts")],
2525
logging: process.env.NODE_ENV === "development",
2626
subscribers: [PostgresSubscriber],
27+
ssl: process.env.DB_CA_CERT
28+
? {
29+
rejectUnauthorized: false,
30+
ca: process.env.DB_CA_CERT,
31+
}
32+
: false,
2733
};
2834

2935
export const AppDataSource = new DataSource(dataSourceOptions);

platforms/evoting-api/src/database/data-source.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export const dataSourceOptions: DataSourceOptions = {
2222
migrations: [path.join(__dirname, "migrations", "*.ts")],
2323
logging: process.env.NODE_ENV === "development",
2424
subscribers: [PostgresSubscriber],
25+
ssl: process.env.DB_CA_CERT
26+
? {
27+
rejectUnauthorized: false,
28+
ca: process.env.DB_CA_CERT,
29+
}
30+
: false,
2531
};
2632

2733
export const AppDataSource = new DataSource(dataSourceOptions);

platforms/group-charter-manager-api/src/database/data-source.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ export const AppDataSource = new DataSource({
1818
entities: [User, Group, Message, CharterSignature],
1919
migrations: [path.join(__dirname, "migrations", "*.ts")],
2020
subscribers: [PostgresSubscriber],
21+
ssl: process.env.DB_CA_CERT
22+
? {
23+
rejectUnauthorized: false,
24+
ca: process.env.DB_CA_CERT,
25+
}
26+
: false,
2127
});

platforms/pictique-api/src/database/data-source.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ export const AppDataSource = new DataSource({
2020
entities: [User, Post, Comment, Message, Chat, MessageReadStatus],
2121
migrations: [path.join(__dirname, "migrations", "*.ts")],
2222
subscribers: [PostgresSubscriber],
23+
ssl: process.env.DB_CA_CERT
24+
? {
25+
rejectUnauthorized: false,
26+
ca: process.env.DB_CA_CERT,
27+
}
28+
: false,
2329
});

platforms/registry/src/config/database.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@ export const AppDataSource = new DataSource({
1717
migrations: [join(__dirname, "../migrations/*.{ts,js}")],
1818
migrationsTableName: "migrations",
1919
subscribers: [],
20+
ssl: process.env.DB_CA_CERT
21+
? {
22+
rejectUnauthorized: false,
23+
ca: process.env.DB_CA_CERT,
24+
}
25+
: false,
2026
})

0 commit comments

Comments
 (0)