-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgAdaptor.js
31 lines (27 loc) · 861 Bytes
/
pgAdaptor.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module.exports = {db : function(){
var isProduction = process.env.DATABASE_URL ? true : false;
var db = {};
if(isProduction){
// db Connection w/ Heroku
db = require('knex')({
client: 'pg',
connection: {
connectionString: process.env.DATABASE_URL ||
"postgres://gjqlhvnhleneub:dd5149eb82a5b15ad13719f5a237e402d50e9d23e7c8ac72daf918f9381d22b6@ec2-54-204-35-248.compute-1.amazonaws.com:5432/d7mtiics2ervga",
ssl: true,
}
});
} else{
// db Connection w/ localhost
db = require('knex')({
client: 'pg',
connection: {
host : '127.0.0.1',
user : 'postgres',
password : 'postgres',
database : 'crud-starter-api'
}
});
}
return db;
}()};