Explorar el Código

development and production config

xy hace 7 años
padre
commit
4131ba3432
Se han modificado 1 ficheros con 12 adiciones y 2 borrados
  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';