This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
/
config.js
46 lines (43 loc) · 1.63 KB
/
config.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const DEFAULT_NETWORK = process.env.NEAR_NETWORK || process.env.NEAR_ENV || 'testnet';
if (process.env.NEAR_NETWORK && process.env.NEAR_ENV){
console.log(`Warning: NEAR_NETWORK and NEAR_ENV are both set! We will use NEAR_NETWORK (${process.env.NEAR_NETWORK})\n`);
}
function getConfig(env) {
let config;
switch (env) {
case 'production':
case 'mainnet':
config = {
networkId: 'mainnet',
nodeUrl: process.env.NEAR_MAINNET_RPC || 'https://rpc.mainnet.near.org',
walletUrl: process.env.NEAR_MAINNET_WALLET || 'https://app.mynearwallet.com',
helperUrl: 'https://helper.mainnet.near.org',
helperAccount: 'near',
};
break;
case 'development':
case 'testnet':
config = {
networkId: 'testnet',
nodeUrl: process.env.NEAR_TESTNET_RPC || 'https://rpc.testnet.near.org',
walletUrl: process.env.NEAR_TESTNET_WALLET || 'https://testnet.mynearwallet.com',
helperUrl: 'https://helper.testnet.near.org',
helperAccount: 'testnet',
};
break;
case 'custom':
config = {
networkId: 'custom',
nodeUrl: process.env.NEAR_CUSTOM_RPC,
walletUrl: process.env.NEAR_CUSTOM_WALLET,
helperUrl: process.env.NEAR_CUSTOM_HELPER,
helperAccount: process.env.NEAR_CUSTOM_TLA,
};
break;
default:
throw Error(`Unconfigured environment '${env}'. Can be configured in src/config.js.`);
}
config['initialBalance'] = '1' + '0'.repeat(24);
return config;
}
module.exports = { getConfig, DEFAULT_NETWORK };