1 | const debug = require('debug')('ice:util:url');
|
2 |
|
3 | const FUSION_DESIGN_LOCAL_URL = 'http://127.0.0.1:7001';
|
4 | const FUSION_DESIGN_DAILY_URL = 'https://fusion.taobao.net';
|
5 | const FUSION_DESIGN_PRE_URL = 'https://pre-www.fusion.design';
|
6 | const FUSION_DESIGN_URL = 'https://fusion.design';
|
7 |
|
8 | const URLS = {
|
9 | local: {
|
10 | fusionDesignUrl: FUSION_DESIGN_LOCAL_URL,
|
11 | },
|
12 | daily: {
|
13 | fusionDesignUrl: FUSION_DESIGN_DAILY_URL,
|
14 | },
|
15 | pre: {
|
16 | fusionDesignUrl: FUSION_DESIGN_PRE_URL,
|
17 | },
|
18 | prod: {
|
19 | fusionDesignUrl: FUSION_DESIGN_URL,
|
20 | },
|
21 | };
|
22 |
|
23 | let url;
|
24 | module.exports = function getUrl() {
|
25 | if (url) {
|
26 | return url;
|
27 | }
|
28 | const { ENV } = process.env;
|
29 | url = URLS[ENV];
|
30 | if (!url) {
|
31 | url = URLS.prod;
|
32 | }
|
33 | debug('url: %j', url);
|
34 | return url;
|
35 | };
|