UNPKG

748 BJavaScriptView Raw
1const debug = require('debug')('ice:util:url');
2
3const FUSION_DESIGN_LOCAL_URL = 'http://127.0.0.1:7001';
4const FUSION_DESIGN_DAILY_URL = 'https://fusion.taobao.net';
5const FUSION_DESIGN_PRE_URL = 'https://pre-www.fusion.design';
6const FUSION_DESIGN_URL = 'https://fusion.design';
7
8const 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
23let url;
24module.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};