-
Notifications
You must be signed in to change notification settings - Fork 92
/
config.js
33 lines (31 loc) · 1.2 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
(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://studio.nearprotocol.com/devnet',
helperUrl: 'https://studio.nearprotocol.com/contract-api',
contractName: CONTRACT_NAME,
};
case 'local':
case 'test':
return {
networkId: 'local',
nodeUrl: 'http://localhost:3030',
contractName: CONTRACT_NAME
};
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);
}
})();