-
Notifications
You must be signed in to change notification settings - Fork 92
/
config.js
71 lines (68 loc) · 2.54 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
(function() {
const CONTRACT_NAME = 'near-hello-devnet'; /* TODO: fill this in! */
const DEFAULT_ENV = 'development';
function getConfig(env) {
switch (env) {
case 'production':
case 'development':
return {
networkId: 'default',
nodeUrl: 'https://rpc.nearprotocol.com',
contractName: CONTRACT_NAME,
walletUrl: 'https://wallet.nearprotocol.com',
};
case 'staging':
return {
networkId: 'staging',
nodeUrl: 'https://staging-rpc.nearprotocol.com/',
contractName: CONTRACT_NAME,
walletUrl: 'https://near-wallet-staging.onrender.com',
};
case 'local':
return {
networkId: 'local',
nodeUrl: 'http://localhost:3030',
keyPath: `${process.env.HOME}/.near/validator_key.json`,
walletUrl: 'http://localhost:4000/wallet',
contractName: CONTRACT_NAME,
};
case 'test':
return {
networkId: 'local',
nodeUrl: 'http://localhost:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
};
case 'test-remote':
case 'ci':
return {
networkId: 'shared-test',
nodeUrl: 'http://shared-test.nearprotocol.com:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
};
case 'ci-staging':
return {
networkId: 'shared-test-staging',
nodeUrl: 'http://staging-shared-test.nearprotocol.com:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
};
case 'tatooine':
return {
networkId: 'tatooine',
nodeUrl: 'https://rpc.tatooine.nearprotocol.com',
contractName: CONTRACT_NAME,
walletUrl: 'https://wallet.tatooine.nearprotocol.com',
};
default:
throw Error(`Unconfigured environment '${env}'. Can be configured in src/config.js.`);
}
}
const cookieConfig = typeof Cookies != 'undefined' && Cookies.getJSON('fiddleConfig');
if (typeof module !== 'undefined' && module.exports) {
module.exports = getConfig;
} else {
window.nearConfig = cookieConfig && cookieConfig.nearPages ? cookieConfig : getConfig(DEFAULT_ENV);
}
})();