diff --git a/package-lock.json b/package-lock.json index bacd7f5..700ab42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2272,8 +2272,12 @@ "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", +<<<<<<< HEAD + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" +======= "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", "dev": true +>>>>>>> 09846f9d2fda1e4b6e719856095833f42ed0a0ba }, "rc": { "version": "1.2.8", diff --git a/src/database/db_connection.js b/src/database/db_connection.js index 0675060..64e9b2a 100644 --- a/src/database/db_connection.js +++ b/src/database/db_connection.js @@ -9,18 +9,15 @@ if (process.env.NODE_ENV === "test") { if (!DATABASE_URL) throw new Error("Environmental variable DB_URL must be set"); -const params = url.parse(DATABASE_URL); -// console.log('THIS IS PARAMSSSS:', params); -const [username, password] = params.auth.split(":"); +// const params = url.parse(DATABASE_URL); +// // console.log('THIS IS PARAMSSSS:', params); +// const [username, password] = params.auth.split(":"); -const options = { - host: params.hostname, - port: params.port, - database: params.pathname.split("/")[1], - max: process.env.DB_MAX_CONNECTIONS || 2, - user: username, - password, - ssl: params.hostname !== "localhost" -}; +// starsuit code recommendation -module.exports = new Pool(options); +let connectionString = process.env.DATABASE_URL; + +module.exports = new Pool({ + connectionString, + ssl: !connectionString.includes("localhost") +});