-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (24 loc) · 675 Bytes
/
index.js
File metadata and controls
29 lines (24 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
/**
* @return {import("config").IConfig}
*/
function reloadConfigs () {
const config = require('config');
const sources = config.util.getConfigSources();
for (const { name } of sources) {
if (name === '$NODE_CONFIG' || name === '--NODE-CONFIG') {
continue;
}
delete require.cache[name];
}
delete require.cache[require.resolve('config')];
return require('config');
}
/**
* @param {boolean} [reload=false] Whether to reload the configuration
* @return {import("config").IConfig}
*/
module.exports = function (reload) {
return reload ? reloadConfigs() : require('config');
};
module.exports.reloadConfigs = reloadConfigs;