Forked from an inaccessible project.
-
Quentin CHEVALIER authoredQuentin CHEVALIER authored
config.ts 924 B
/**
* @file Importe la configuration du LDAP au sein de l'application, et remplace certaines valeurs en fonction des variables d'environnement.
* @author manifold
*/
import fs from 'fs';
import path from 'path';
import colors from 'colors';
// Point central ; tous les champs du LDAP sont 'cachés' dans config.json et pas visibles directement
let path_config = path.resolve('..','ldap_config.json')
console.log(colors.cyan("Loading LDAP config file from "+path_config));
export const ldapConfig = JSON.parse(fs.readFileSync(path_config).toString());
let path_credentials = path.resolve('..','ldap_credentials.json')
console.log(colors.cyan("Loading LDAP credentials from "+path_credentials));
export const credentialsLdapConfig = JSON.parse(fs.readFileSync(path_credentials).toString());
// Override config server from environment
if (process.env.LDAP_URI != null) {
ldapConfig.ldap.server = process.env.LDAP_URI;
}