UNPKG

530 BJavaScriptView Raw
1const debug = require('debug')('jenv:loader');
2
3module.exports = function () {
4 const configFilePath = process.env.CONFIG_FILE || process.env.JENV_FILE_NAME;
5 if (!configFilePath) {
6 throw new Error(`please set environment "CONFIG_FILE" or "JENV_FILE_NAME".`);
7 }
8
9 debug(`load config from ${configFilePath}`);
10 if (!require('fs').existsSync(configFilePath)) {
11 throw new Error(`config file ${configFilePath} not exists.`);
12 }
13 return require(configFilePath);
14};
15
16Object.defineProperty(exports, "__esModule", { value: true });