forked from near/near-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-config.js
More file actions
19 lines (18 loc) · 723 Bytes
/
Copy pathget-config.js
File metadata and controls
19 lines (18 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module.exports = function getConfig() {
const configPath = process.cwd() + '/src/config';
const nearEnv = process.env.NEAR_ENV || process.env.NODE_ENV || 'development';
try {
const config = require(configPath)(nearEnv);
return config;
} catch (e) {
if (e.code == 'MODULE_NOT_FOUND') {
if (process.env.NEAR_DEBUG) {
// TODO: Use debug module instead, see https://github.com/near/near-api-js/pull/250
console.warn(`[WARNING] Didn't find config at ${configPath}, using default shell config`);
}
const defaultConfig = require('./config')(nearEnv);
return defaultConfig;
}
throw e;
}
};