Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

Commit

Permalink
make lockTime configurable via env var
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew committed Dec 14, 2016
1 parent 053346f commit 596f583
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function SessionOAuth2 (opts) {
_.extend(this, {
sessionLookupPrefix: 'user-',
sessionLockPrefix: 'user-token-lock-',
lockTime: 300,
lockTime: toInt(process.env.AUTHZ_CACHE_DEFAULT_TTL_SECONDS, 300),
client: redis.createClient(process.env.LOGIN_CACHE_REDIS),
clientId: process.env.OAUTH2_CLIENT_ID,
clientSecret: process.env.OAUTH2_CLIENT_SECRET,
Expand Down Expand Up @@ -113,4 +113,9 @@ function error500 () {
return error
}

function toInt (val, _default) {
const integer = parseInt(val, 10)
return isNaN(integer) ? _default : integer
}

module.exports = SessionOAuth2

0 comments on commit 596f583

Please sign in to comment.