Skip to content

Commit

Permalink
Add postgres env vars (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
imechoim authored Jan 10, 2024
1 parent 5a6c06d commit 8593b5e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ export class Utils {
const pgPassword = pgRdsConfig.password;
const pgUsername = pgRdsConfig.username;
dsnList = `postgres://${pgUsername}:${pgPassword}@${pgHost}:${pgPort}/${pgDb}?ssl=true`;
} else if (
process.env.POSTGRES_HOSTS &&
process.env.POSTGRES_PORT &&
process.env.POSTGRES_USER_PASSWD &&
process.env.POSTGRES_USER_NAME &&
process.env.POSTGRES_DB_NAME
) {
dsnList = process.env.POSTGRES_HOSTS.split(',')
.map((host) => {
return `postgres://${process.env.POSTGRES_USER_NAME}:${process.env.POSTGRES_USER_PASSWD}@${host}:${process.env.POSTGRES_PORT}/${process.env.POSTGRES_DB_NAME}?ssl=true`;
})
.join(',');
} else {
dsnList = process.env.POSTGRES_DSN_LIST;
}
Expand Down

0 comments on commit 8593b5e

Please sign in to comment.