Skip to content

Commit

Permalink
Add: Clinical and PII DBs for Poland in Staging.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilen-7DIGIT committed Oct 22, 2024
1 parent 2d095c5 commit 17e2295
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions service/utils/dbConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,32 @@ const CLINICAL_PG_POOL_KZ = new pg.Pool({
connectionString: process.env.CLINICAL_DB_URL_KZ,
});

// PL Database connection strings
const PII_PG_POOL_PL = new pg.Pool({
connectionString: process.env.PII_DB_URL_PL,
});
const CLINICAL_PG_POOL_PL = new pg.Pool({
connectionString: process.env.CLINICAL_DB_URL_PL,
});

const IS_DEV = process.env.NODE_ENV === "development";

export const getDBPool = (dbType, country) => {
if (dbType === "masterDb") return MASTER_PG_POOL;
else {
if (IS_DEV) {
if (dbType === "piiDb") return PII_PG_POOL_KZ;
else if (dbType === "clinicalDb") return CLINICAL_PG_POOL_KZ;
}

switch (country) {
case "KZ":
if (dbType === "piiDb") return PII_PG_POOL_KZ;
else if (dbType === "clinicalDb") return CLINICAL_PG_POOL_KZ;
else throw Error("DB Type not recognized");
case "PL":
if (dbType === "piiDb") return PII_PG_POOL_KZ;
else if (dbType === "clinicalDb") return CLINICAL_PG_POOL_KZ;
if (dbType === "piiDb") return PII_PG_POOL_PL;
else if (dbType === "clinicalDb") return CLINICAL_PG_POOL_PL;
else throw Error("DB Type not recognized");
default:
throw Error("DB Country not recognized");
Expand Down

0 comments on commit 17e2295

Please sign in to comment.