ldap user

This commit is contained in:
2020-05-01 17:57:25 -04:00
parent 7d9ea08ec9
commit 607a5f33af
15 changed files with 349 additions and 135 deletions

13
nodejs/conf/base.js Normal file
View File

@ -0,0 +1,13 @@
'use strict';
module.exports = {
userModel: 'redis', // pam, redis, ldap
ldap: {
url: 'ldap://192.168.1.55:389',
bindDN: 'cn=ldapclient service,ou=people,dc=theta42,dc=com',
bindPassword: '__IN SRECREST FILE__',
searchBase: 'ou=people,dc=theta42,dc=com',
userFilter: '(objectClass=inetOrgPerson)',
userNameAttribute: 'uid'
}
};

32
nodejs/conf/conf.js Normal file
View File

@ -0,0 +1,32 @@
'use strict';
const extend = require('extend');
const environment = process.env.NODE_ENV || 'development';
function load(filePath, required){
try {
return require(filePath);
} catch(error){
if(error.name === 'SyntaxError'){
console.error(`Loading ${filePath} file failed!\n`, error);
process.exit(1);
} else if (error.code === 'MODULE_NOT_FOUND'){
console.warn(`No config file ${filePath} FOUND! This may cause issues...`);
if (required){
process.exit(1);
}
return {};
}else{
console.dir(`Unknown error in loading ${filePath} config file.\n`, error);
}
}
};
module.exports = extend(
true, // enable deep copy
load('./base', true),
load(`./${environment}`),
load('./secrets'),
{environment}
);