Skip to content
Snippets Groups Projects
Commit d75713b9 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

fix(db-manager): fix immutability issue of db config so that it can be extended

parent abec6426
No related branches found
No related tags found
1 merge request!92fix(db-manager): fix immutability issue of db config so that it can be extended
...@@ -39,6 +39,7 @@ services: ...@@ -39,6 +39,7 @@ services:
- POSTGRES_DB=${POSTGRES_DB:-test_db} - POSTGRES_DB=${POSTGRES_DB:-test_db}
- POSTGRES_USER=${POSTGRES_USER:-test_user} - POSTGRES_USER=${POSTGRES_USER:-test_user}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
- POSTGRES_ALLOW_SELF_SIGNED_CERTIFICATES=1
- PUBSWEET_SECRET=${PUBSWEET_SECRET:-theSecret} - PUBSWEET_SECRET=${PUBSWEET_SECRET:-theSecret}
- SERVER_PORT=${SERVER_PORT:-3000} - SERVER_PORT=${SERVER_PORT:-3000}
# - CLIENT_URL=${CLIENT_URL:-http://0.0.0.0:4000////} # - CLIENT_URL=${CLIENT_URL:-http://0.0.0.0:4000////}
......
...@@ -2,9 +2,11 @@ const config = require('config') ...@@ -2,9 +2,11 @@ const config = require('config')
const { isEnvVariableTrue } = require('../utils/env') const { isEnvVariableTrue } = require('../utils/env')
const connection = const connectionConfig =
process.env.DATABASE_URL || config['pubsweet-server'] && config['pubsweet-server'].db
(config['pubsweet-server'] && config['pubsweet-server'].db)
// clone to allow mutation for the case of adding ssl
const connection = process.env.DATABASE_URL || { ...connectionConfig }
if (isEnvVariableTrue(process.env.POSTGRES_ALLOW_SELF_SIGNED_CERTIFICATES)) { if (isEnvVariableTrue(process.env.POSTGRES_ALLOW_SELF_SIGNED_CERTIFICATES)) {
if (!connection.ssl) connection.ssl = {} if (!connection.ssl) connection.ssl = {}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment