diff --git a/README.md b/README.md index 74abcd4..3546f38 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ module.exports = { | | `MONGODB_URI` | Connection string to the MongoDB server | `mongodb://localhost:27017` | | | `RECEIVE_ONLY` | True if Sivy works on receive_only mode | `false` | | :bangbang: | `AUTH_CLIENT_SECRET` | The secret to validate the JWT. | | +| | `MORGAN_FORMAT` | Log format used by Morgan package | `combined` for production, else `dev` | | | `DEBUG` | Set to `sivy` to turn on debug logging. | | ### Authentication diff --git a/config/config.js b/config/config.js index ff363ed..2046a6f 100644 --- a/config/config.js +++ b/config/config.js @@ -4,7 +4,6 @@ class Config { app.use(require('body-parser').urlencoded({extended: true})); app.use(require('cookie-parser')()); - app.use(require('morgan')('dev')); require('node-friendly-response'); diff --git a/config/development.js b/config/development.js index 5bc8c70..3678ce2 100644 --- a/config/development.js +++ b/config/development.js @@ -1,9 +1,10 @@ +const {MORGAN_FORMAT} = process.env; const Config = require('./config'); class Development extends Config { static configure(app) { super.configure(app); - app.use(require('morgan')('dev')); + app.use(require('morgan')(MORGAN_FORMAT || 'dev')); app.use(require('cors')({ credentials: true, diff --git a/config/production.js b/config/production.js index 4147bd9..c6d448c 100644 --- a/config/production.js +++ b/config/production.js @@ -1,9 +1,10 @@ +const {MORGAN_FORMAT} = process.env; const Config = require('./config'); class Production extends Config { static configure(app) { super.configure(app); - app.use(require('morgan')('combined')); + app.use(require('morgan')(MORGAN_FORMAT || 'combined')); app.use(require('cors')()); } } diff --git a/config/staging.js b/config/staging.js index b071c80..94aa6a0 100644 --- a/config/staging.js +++ b/config/staging.js @@ -1,9 +1,10 @@ +const {MORGAN_FORMAT} = process.env; const Config = require('./config'); class Staging extends Config { static configure(app) { super.configure(app); - app.use(require('morgan')('combined')); + app.use(require('morgan')(MORGAN_FORMAT || 'combined')); app.use(require('cors')()); } }