Skip to content

Commit

Permalink
Add SSL mode to database connection configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
joonashak committed Jun 27, 2024
1 parent d1f34af commit 5300075
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/src/config/config.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const configSchema = object({
name: string(),
host: string(),
port: number(),
ssl: boolean(),
}),
});

Expand Down
2 changes: 2 additions & 0 deletions server/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const {
DATABASE_NAME,
DATABASE_HOST,
DATABASE_PORT,
DATABASE_SSL_MODE,
} = process.env;

const config = {
Expand Down Expand Up @@ -46,6 +47,7 @@ const config = {
name: DATABASE_NAME,
host: DATABASE_HOST,
port: Number(DATABASE_PORT),
ssl: DATABASE_SSL_MODE === "true",
},
};

Expand Down
1 change: 1 addition & 0 deletions server/src/database/migration-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default new DataSource({
username: process.env.DATABASE_USERNAME || "postgres",
password: process.env.DATABASE_PASSWORD || "postgres",
database: process.env.DATABASE_NAME || "keijo_dev",
ssl: process.env.DATABASE_SSL_MODE === "true",
/**
* Glob pattern is used to make this work both locally and in CI as it appears that
* using no wildcards resolves to different paths between the two. This is arguably
Expand Down

0 comments on commit 5300075

Please sign in to comment.