Fix db connection (use env vars)

This commit is contained in:
Tom Russell 2018-09-30 20:27:53 +01:00
parent 775f08ab2d
commit 2e80c9d2e9

View File

@ -12,7 +12,13 @@ import pg from 'pg-promise';
// pg-promise, can provide initialisation options
const pgp = pg();
// database connection, can provide connection string or object (should default to env vars)
const db = pgp();
// database connection (default to env vars)
const db = pgp({
'host': process.env.PGHOST,
'dbname': process.env.PGDATABASE,
'user': process.env.PGUSER,
'password': process.env.PGPASSWORD,
'port': process.env.PGPORT
});
export default db;