Skip to content

Commit

Permalink
Add fallbacks for unset env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
micahmo committed May 10, 2024
1 parent d503177 commit 76655e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_HOSTNAME=postgres
POSTGRES_PORT=5432
POSTGRES_DATABASE=thunder-database

APNS_KEY_ID=key_id
APNS_TEAM_ID=team_id
Expand Down
2 changes: 1 addition & 1 deletion src/database/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dotenv.config();

// Configure database
const sequelize = new Sequelize(
`postgres://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASSWORD}@${process.env.POSTGRES_HOSTNAME}:${process.env.POSTGRES_PORT}/thunder-database`
`postgres://${process.env.POSTGRES_USER ?? "user"}:${process.env.POSTGRES_PASSWORD ?? "password"}@${process.env.POSTGRES_HOSTNAME ?? "postgres"}:${process.env.POSTGRES_PORT ?? "5432"}/${process.env.POSTGRES_DATABASE ?? "thunder-database"}`
);

export default sequelize;

0 comments on commit 76655e2

Please sign in to comment.