Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
enable logging via env variable (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
Henni authored Apr 23, 2017
1 parent 77b8297 commit 490a7ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions config.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ module.exports = {
},
"api" : {
"apiKey": process.env.apikey || "not so secret"
},
"general": {
"logging": process.env.logging || false
}
};
8 changes: 5 additions & 3 deletions database.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ module.exports = {
var databaseParams = dbConfig.database;
context.config = databaseParams;

if(logging === undefined) {
logging = dbConfig.general.logging;
}

var configDB = {
database: databaseParams.collection, //env var: PGDATABASE
username: databaseParams.username,
Expand All @@ -97,9 +101,7 @@ module.exports = {

if (databaseURI) {
//logging is enabled by default
if(!logging) {
dbConfig.logging = false
}
dbConfig.logging = logging;
dbConfig.pool = {
max: 1,
min: 0
Expand Down

0 comments on commit 490a7ac

Please sign in to comment.