Skip to content

Commit

Permalink
Add postgres env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
imechoim committed Jan 9, 2024
1 parent 6a09323 commit 2a778ea
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 2a778ea

Please sign in to comment.