Skip to content

Instantly share code, notes, and snippets.

View cyjeff's full-sized avatar
💭
keep striving

Yu Chu (Jeff) cyjeff

💭
keep striving
View GitHub Profile
@cyjeff
cyjeff / knexfile.js
Last active March 21, 2021 06:33
SSL setting for Knex.js to postgreSQL on Heroku
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({