This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const knex = require("knex"); | |
const parse = require("pg-connection-string").parse; | |
// Parse the environment variable into an object containing User, Password, Host, Port etc at separate key-value pairs | |
const pgconfig = parse(process.env.DATABASE_URL); | |
// Add SSL setting to default environment variable on a new key-value pair (the value itself is an object) | |
pgconfig.ssl = { rejectUnauthorized: false }; | |
const db = knex({ |