Skip to content

Commit b6f4385

Browse files
committed
Staging db configuration
1 parent b43a4dc commit b6f4385

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

backend/src/db/connection.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ require('dotenv').config()
44
const config = require('./knexfile.js')
55
const knexModule = require('knex')
66

7-
const { NODE_ENV } = process.env
8-
const env = NODE_ENV === 'staging' ? 'production' : NODE_ENV || 'not working'
9-
7+
const env = process.env.NODE_ENV ? process.env.NODE_ENV : 'not working'
108
let knex
119

1210
module.exports.getKnex = () => {

backend/src/db/knexfile.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,21 @@ module.exports = {
5252
seeds: {
5353
directory: './src/db/production_seeds'
5454
}
55+
},
56+
staging: {
57+
client: 'pg',
58+
connection: {
59+
connectionString: config.DATABASE_URL,
60+
ssl: {
61+
rejectUnauthorized: false
62+
}
63+
},
64+
useNullAsDefault: true,
65+
migrations: {
66+
directory: './src/db/migrations'
67+
},
68+
seeds: {
69+
directory: './src/db/seeds'
70+
}
5571
}
5672
}

0 commit comments

Comments
 (0)