19 lines
388 B
JavaScript
19 lines
388 B
JavaScript
const utils = require('./utils');
|
|
|
|
let loaded = false;
|
|
let configJson = null;
|
|
|
|
function config(name) {
|
|
if (!loaded) {
|
|
let configDir = './config/';
|
|
if (utils.isOnlineEnv()) {
|
|
configDir = '../config/';
|
|
}
|
|
loaded = true;
|
|
configJson = utils.readJsonFromFile(configDir + 'config.json');
|
|
}
|
|
return configJson ? configJson[name] : null;
|
|
}
|
|
|
|
module.exports = config;
|