Explorar el Código

明确环境变量规则

Michael Wang hace 5 años
padre
commit
200ffc63c4
Se han modificado 2 ficheros con 15 adiciones y 17 borrados
  1. 4 2
      .env.development
  2. 11 15
      vue.config.js

+ 4 - 2
.env.development

@@ -1,4 +1,4 @@
-#### 如果需要改变以下环境变量的值,请在根目录下新增 .env.local 文件,里面设置的变量会覆盖本文件
+#### 如果需要改变以下环境变量的值,请在根目录下新增 .env.development.local 文件,里面设置的变量会覆盖本文件,并且不会被提交
 VUE_APP_CORE_HOST_URL=http://192.168.10.39:8000
 VUE_APP_EXAM_WORK_HOST_URL=http://192.168.10.39:8001
 VUE_APP_QUESTIONS_HOST_URL=http://192.168.10.39:8008
@@ -6,4 +6,6 @@ VUE_APP_OE_HOST_URL=http://192.168.10.39:8013
 VUE_APP_MARKING_HOST_URL=http://192.168.10.39:8004
 VUE_APP_DATA_PROCESS_HOST_URL=http://192.168.10.39:8005
 VUE_APP_REPORTS_HOST_URL=http://192.168.10.39:8015
-VUE_APP_TASK_HOST_URL=http://192.168.10.39:8011
+VUE_APP_TASK_HOST_URL=http://192.168.10.39:8011
+VUE_APP_PRINT_HOST_URL=http://192.168.10.39:8009
+VUE_APP_EXCHANGE_HOST_URL=http://192.168.10.39:8007

+ 11 - 15
vue.config.js

@@ -1,50 +1,46 @@
 const proxy = {
   "/api/ecs_core": {
-    target: process.env.VUE_APP_CORE_HOST_URL || "http://192.168.10.39:8000",
+    target: process.env.VUE_APP_CORE_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_exam_work": {
-    target:
-      process.env.VUE_APP_EXAM_WORK_HOST_URL || "http://192.168.10.39:8001",
+    target: process.env.VUE_APP_EXAM_WORK_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_outlet": {
-    target:
-      process.env.VUE_APP_EXCHANGE_HOST_URL || "http://192.168.10.39:8007",
+    target: process.env.VUE_APP_EXCHANGE_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_ques": {
-    target:
-      process.env.VUE_APP_QUESTIONS_HOST_URL || "http://192.168.10.39:8008",
+    target: process.env.VUE_APP_QUESTIONS_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_oe_admin": {
-    target: process.env.VUE_APP_OE_HOST_URL || "http://192.168.10.39:8013",
+    target: process.env.VUE_APP_OE_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_oe_student": {
-    target: process.env.VUE_APP_OE_HOST_URL || "http://192.168.10.39:8003",
+    target: process.env.VUE_APP_OE_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_marking": {
-    target: process.env.VUE_APP_MARKING_HOST_URL || "http://192.168.10.39:8004",
+    target: process.env.VUE_APP_MARKING_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_data_process": {
-    target:
-      process.env.VUE_APP_DATA_PROCESS_HOST_URL || "http://192.168.10.39:8005",
+    target: process.env.VUE_APP_DATA_PROCESS_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_prt": {
-    target: process.env.VUE_APP_PRINT_HOST_URL || "http://192.168.10.39:8009",
+    target: process.env.VUE_APP_PRINT_HOST_URL,
     changeOrigin: true
   },
   "/api/ctr/task": {
-    target: process.env.VUE_APP_TASK_HOST_URL || "http://192.168.10.39:8011",
+    target: process.env.VUE_APP_TASK_HOST_URL,
     changeOrigin: true
   },
   "/api/ecs_reports": {
-    target: process.env.VUE_APP_REPORTS_HOST_URL || "http://192.168.10.39:8015",
+    target: process.env.VUE_APP_REPORTS_HOST_URL,
     changeOrigin: true
   }
 };