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

Merge branch 'db-config' into 'main'

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

See merge request !92
parents abec6426 d75713b9
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:
- POSTGRES_DB=${POSTGRES_DB:-test_db}
- POSTGRES_USER=${POSTGRES_USER:-test_user}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
- POSTGRES_ALLOW_SELF_SIGNED_CERTIFICATES=1
- PUBSWEET_SECRET=${PUBSWEET_SECRET:-theSecret}
- SERVER_PORT=${SERVER_PORT:-3000}
# - CLIENT_URL=${CLIENT_URL:-http://0.0.0.0:4000////}
......
......@@ -2,9 +2,11 @@ const config = require('config')
const { isEnvVariableTrue } = require('../utils/env')
const connection =
process.env.DATABASE_URL ||
(config['pubsweet-server'] && config['pubsweet-server'].db)
const connectionConfig =
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 (!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