Skip to content

Commit b43a4dc

Browse files
committed
Update database connection
1 parent d923970 commit b43a4dc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

backend/src/db/connection.js

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

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

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

backend/src/db/knexfile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ module.exports = {
3939
},
4040
production: {
4141
client: 'pg',
42-
connection: config.DATABASE_URL,
42+
connection: {
43+
connectionString: config.DATABASE_URL,
44+
ssl: {
45+
rejectUnauthorized: false
46+
}
47+
},
4348
useNullAsDefault: true,
4449
migrations: {
4550
directory: './src/db/migrations'

0 commit comments

Comments
 (0)