beta
This commit is contained in:
		
							
								
								
									
										15
									
								
								nodejs/conf/base.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								nodejs/conf/base.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| module.exports = { | ||||
| 	userModel: 'ldap', // pam, redis, ldap | ||||
| 	ldap: { | ||||
| 		url: 'ldap://192.168.1.54:389', | ||||
| 		bindDN: 'cn=admin,dc=theta42,dc=com', | ||||
| 		bindPassword: '__IN SRECREST FILE__', | ||||
| 		userBase: 'ou=people,dc=theta42,dc=com', | ||||
| 		groupBase: 'ou=groups,dc=theta42,dc=com',		 | ||||
| 		userFilter: '(objectClass=posixAccount)', | ||||
| 		userNameAttribute: 'uid' | ||||
| 	}, | ||||
| 	SENDGRID_API_KEy: '__IN SRECREST FILE__', | ||||
| }; | ||||
							
								
								
									
										32
									
								
								nodejs/conf/conf.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								nodejs/conf/conf.js
									
									
									
									
									
										Normal 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} | ||||
| ); | ||||
		Reference in New Issue
	
	Block a user