-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not read config.json if OVERRIDE_CONFIG=false
- Loading branch information
1 parent
53065f1
commit 8b80e88
Showing
2 changed files
with
45 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,46 @@ | ||
var nconf = require('nconf'); | ||
var defaults = { | ||
PORT: 4000, | ||
SESSION_SECRET: 'a1b2c3d4567', | ||
AUTHENTICATION: 'FORM', | ||
LDAP_SEARCH_QUERY: '(&(objectCategory=person)(anr={0}))', | ||
LDAP_SEARCH_ALL_QUERY: '(objectCategory=person)', | ||
LDAP_SEARCH_GROUPS: '(member:1.2.840.113556.1.4.1941:={0})', | ||
LDAP_USER_BY_NAME: '(sAMAccountName={0})', | ||
WSFED_ISSUER: 'urn:auth0', | ||
AGENT_MODE: true, | ||
GROUPS: true, | ||
LDAP_HEARTBEAT_SECONDS: 60, | ||
GROUPS_TIMEOUT_SECONDS: 20, | ||
GROUP_PROPERTY: 'cn', | ||
GROUPS_CACHE_SECONDS: 600, | ||
ALLOW_PASSWORD_EXPIRED: false, | ||
ALLOW_PASSWORD_CHANGE_REQUIRED: false, | ||
OVERRIDE_CONFIG: true, | ||
CACHE_FILE: __dirname + '/../cache.db' | ||
}; | ||
|
||
nconf.env('||') | ||
.file({ | ||
file: __dirname + '/../config.json', | ||
logicalSeparator: '||', | ||
format: { | ||
parse: function (content) { | ||
return JSON.parse(content); | ||
}, | ||
stringify: function (content){ | ||
var result = JSON.stringify(content, null, 2); | ||
if (process.platform === 'win32') { | ||
result = result.replace(/\n/ig, "\r\n"); | ||
} | ||
return result; | ||
} | ||
} | ||
}) | ||
.env() | ||
.defaults({ | ||
PORT: 4000, | ||
SESSION_SECRET: 'a1b2c3d4567', | ||
AUTHENTICATION: 'FORM', | ||
LDAP_SEARCH_QUERY: '(&(objectCategory=person)(anr={0}))', | ||
LDAP_SEARCH_ALL_QUERY: '(objectCategory=person)', | ||
LDAP_SEARCH_GROUPS: '(member:1.2.840.113556.1.4.1941:={0})', | ||
LDAP_USER_BY_NAME: '(sAMAccountName={0})', | ||
WSFED_ISSUER: 'urn:auth0', | ||
AGENT_MODE: true, | ||
GROUPS: true, | ||
LDAP_HEARTBEAT_SECONDS: 60, | ||
GROUPS_TIMEOUT_SECONDS: 20, | ||
GROUP_PROPERTY: 'cn', | ||
GROUPS_CACHE_SECONDS: 600, | ||
ALLOW_PASSWORD_EXPIRED: false, | ||
ALLOW_PASSWORD_CHANGE_REQUIRED: false, | ||
OVERRIDE_CONFIG: true, | ||
CACHE_FILE: __dirname + '/../cache.db' | ||
}); | ||
if (process.env.OVERRIDE_CONFIG === 'false') { | ||
nconf.overrides({ OVERRIDE_CONFIG: false }) | ||
.env('||') | ||
.defaults(defaults); | ||
} else { | ||
nconf.env('||') | ||
.file({ | ||
file: __dirname + '/../config.json', | ||
logicalSeparator: '||', | ||
format: { | ||
parse: function (content) { | ||
return JSON.parse(content); | ||
}, | ||
stringify: function (content){ | ||
var result = JSON.stringify(content, null, 2); | ||
if (process.platform === 'win32') { | ||
result = result.replace(/\n/ig, "\r\n"); | ||
} | ||
return result; | ||
} | ||
} | ||
}) | ||
.defaults(defaults); | ||
} |