Skip to content

Commit

Permalink
Database environment for ssl config
Browse files Browse the repository at this point in the history
Update database ssl config to use database specific flag

closes #336
  • Loading branch information
TangoYankee committed Jun 28, 2024
1 parent 492e26a commit 0174cea
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 🎭 Staging
on:
push:
branches:
- main
- 336/correction-development-env

jobs:
migrate:
Expand Down
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_NAME!,
ssl: process.env.NODE_ENV === "production" && {
ssl: process.env.DATABASE_ENV !== "development" && {
rejectUnauthorized: false,
},
},
Expand Down
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ DATABASE_PASSWORD=postgres
DATABASE_NAME=zoning
DATABASE_PORT=8010
DATABASE_HOST=localhost
DATABASE_ENV=development
STORAGE_URL=
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const DbConfig = registerAs("db", () => ({
user: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
name: process.env.DATABASE_NAME,
nodeEnv: process.env.NODE_ENV,
env: process.env.DATABASE_ENV,
}));

export const FeatureFlagConfig = registerAs("featureFlag", () => ({}));
Expand Down
2 changes: 1 addition & 1 deletion src/global/providers/db.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const DbProvider: FactoryProvider = {
user: dbConfig.user,
password: dbConfig.password,
database: dbConfig.name,
ssl: dbConfig.nodeEnv === "production" && {
ssl: dbConfig.env !== "development" && {
rejectUnauthorized: false,
},
});
Expand Down

0 comments on commit 0174cea

Please sign in to comment.