Просмотр исходного кода

development and production config

xy 7 лет назад
Родитель
Сommit
4131ba3432
1 измененных файлов с 12 добавлено и 2 удалено
  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 serverIP = 'http://123.206.193.98';
+
+const faasIp = faasEnvironment === 'development' ? localIP : serverIP;
+const graphqlIP = graphqlEnvironment === 'development' ? localIP : serverIP;
+
 const backendPort = '8999';
 const backendPort = '8999';
 const graphqlPort = '3000';
 const graphqlPort = '3000';
-const backend = serverIP + ':' + backendPort;
+
+const backend = faasIp + ':' + backendPort;
 
 
 // graphql 配置
 // graphql 配置
-const graphqlUrl = serverIP + ':' + graphqlPort + '/graphql';
+const graphqlUrl = graphqlIP + ':' + graphqlPort + '/graphql';
 
 
 // api 配置
 // api 配置
 const getIdUrl = backend + '/getuserid';
 const getIdUrl = backend + '/getuserid';