mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
20 lines
479 B
TypeScript
20 lines
479 B
TypeScript
|
import {IConfig} from 'config';
|
||
|
|
||
|
let config: IConfig;
|
||
|
|
||
|
// This function swaps NODE_ENV during the 'config' library load, to load custom config files, then keeps NODE_ENV like before.
|
||
|
export const loadConfig = () => {
|
||
|
if (config) {
|
||
|
return config;
|
||
|
}
|
||
|
const currentNodeEnv = process.env.NODE_ENV;
|
||
|
|
||
|
process.env.NODE_ENV = process.env.POOL;
|
||
|
const configuration = require('config');
|
||
|
process.env.NODE_ENV = currentNodeEnv;
|
||
|
|
||
|
config = configuration;
|
||
|
|
||
|
return config;
|
||
|
};
|