Sfoglia il codice sorgente

development and production config

xy 7 anni fa
parent
commit
4131ba3432
1 ha cambiato i file con 12 aggiunte e 2 eliminazioni
  1. 12 2
      src/config.js

+ 12 - 2
src/config.js

@@ -1,11 +1,21 @@
+// 全局配置
+const faasEnvironment = 'development';
+const graphqlEnvironment = 'production';
+
 // 基础配置
+const localIP = 'http://localhost';
 const serverIP = 'http://123.206.193.98';
+
+const faasIp = faasEnvironment === 'development' ? localIP : serverIP;
+const graphqlIP = graphqlEnvironment === 'development' ? localIP : serverIP;
+
 const backendPort = '8999';
 const graphqlPort = '3000';
-const backend = serverIP + ':' + backendPort;
+
+const backend = faasIp + ':' + backendPort;
 
 // graphql 配置
-const graphqlUrl = serverIP + ':' + graphqlPort + '/graphql';
+const graphqlUrl = graphqlIP + ':' + graphqlPort + '/graphql';
 
 // api 配置
 const getIdUrl = backend + '/getuserid';