Skip to content

Commit

Permalink
Changing logger middleware to get configuration from .env.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Krulis committed Dec 7, 2017
1 parent e3efcb7 commit a6dc91f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ ALLOW_NORMAL_REGISTRATION=true
ALLOW_LDAP_REGISTRATION=false
ALLOW_CAS_REGISTRATION=true


# LOGGER_MIDDLEWARE is active only if NODE_ENV=development

# verbose debug action logging
LOGGER_MIDDLEWARE_VERBOSE=false

# log complete dump of exceptions
LOGGER_MIDDLEWARE_EXCEPTIONS=true
4 changes: 3 additions & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ module.exports = {
"'" + process.env.ALLOW_NORMAL_REGISTRATION + "'",
ALLOW_LDAP_REGISTRATION:
"'" + process.env.ALLOW_LDAP_REGISTRATION + "'",
ALLOW_CAS_REGISTRATION: "'" + process.env.ALLOW_CAS_REGISTRATION + "'"
ALLOW_CAS_REGISTRATION: "'" + process.env.ALLOW_CAS_REGISTRATION + "'",
LOGGER_MIDDLEWARE_VERBOSE: "'" + process.env.LOGGER_MIDDLEWARE_VERBOSE + "'",
LOGGER_MIDDLEWARE_EXCEPTIONS: "'" + process.env.LOGGER_MIDDLEWARE_EXCEPTIONS + "'",
},
gitRevision: {
VERSION: JSON.stringify(gitRevisionPlugin.version()),
Expand Down
9 changes: 8 additions & 1 deletion src/redux/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ const composeEnhancers = REDUX_DEV_SERVER_PORT
const dev = history =>
composeEnhancers(
compose(
applyMiddleware(...getMiddleware(history), loggerMiddleware(!canUseDOM)),
applyMiddleware(
...getMiddleware(history),
loggerMiddleware(
!canUseDOM,
process.env.LOGGER_MIDDLEWARE_VERBOSE === 'true',
process.env.LOGGER_MIDDLEWARE_EXCEPTIONS === 'true'
)
),
!REDUX_DEV_SERVER_PORT && canUseDOM && window.devToolsExtension // if no server is in place and dev tools are available, use them
? window.devToolsExtension()
: f => f
Expand Down

0 comments on commit a6dc91f

Please sign in to comment.