orztv commited on
Commit
cdb203f
·
1 Parent(s): 5cb6df4
Files changed (2) hide show
  1. services.json +2 -1
  2. start.sh +18 -19
services.json CHANGED
@@ -24,8 +24,9 @@
24
  {
25
  "name": "waeb-service",
26
  "command": "echo 'Waeb service is handled by Traefik plugin'",
 
27
  "path_prefix": "/waeb",
28
  "env": {},
29
  "working_dir": "/home/pn/app/waeb"
30
  }
31
- ]
 
24
  {
25
  "name": "waeb-service",
26
  "command": "echo 'Waeb service is handled by Traefik plugin'",
27
+ "port": 8002,
28
  "path_prefix": "/waeb",
29
  "env": {},
30
  "working_dir": "/home/pn/app/waeb"
31
  }
32
+ ]
start.sh CHANGED
@@ -20,7 +20,7 @@ generate_traefik_config() {
20
 
21
  # 添加 Waeb 路由器
22
  echo " waeb-router:" >> $dynamic_config
23
- echo " rule: \"PathPrefix(\`/waeb\`)\"" >> $dynamic_config
24
  echo " service: noop@internal" >> $dynamic_config
25
  echo " middlewares:" >> $dynamic_config
26
  echo " - traefik-plugin-waeb" >> $dynamic_config
@@ -33,17 +33,19 @@ generate_traefik_config() {
33
 
34
  echo "$services" | while read -r service; do
35
  name=$(echo $service | jq -r '.name')
36
- port=$(echo $service | jq -r '.port // "0"')
37
  path_prefix=$(echo $service | jq -r '.path_prefix')
38
 
39
- # 跳过 waeb-service 的路由配置
40
- if [ "$name" != "waeb-service" ]; then
41
- echo " $name:" >> $dynamic_config
42
- echo " rule: \"PathPrefix(\`$path_prefix\`)\"" >> $dynamic_config
43
- echo " service: $name" >> $dynamic_config
44
- echo " priority: 2" >> $dynamic_config
45
- echo " middlewares:" >> $dynamic_config
46
- echo " - ${name}-stripprefix" >> $dynamic_config
 
 
47
  fi
48
  done
49
 
@@ -74,15 +76,12 @@ generate_traefik_config() {
74
 
75
  echo "$services" | while read -r service; do
76
  name=$(echo $service | jq -r '.name')
77
- port=$(echo $service | jq -r '.port // "0"')
78
-
79
- # 跳过 waeb-service 的服务配置
80
- if [ "$name" != "waeb-service" ] && [ "$port" != "0" ]; then
81
- echo " $name:" >> $dynamic_config
82
- echo " loadBalancer:" >> $dynamic_config
83
- echo " servers:" >> $dynamic_config
84
- echo " - url: \"http://localhost:$port\"" >> $dynamic_config
85
- fi
86
  done
87
  }
88
 
 
20
 
21
  # 添加 Waeb 路由器
22
  echo " waeb-router:" >> $dynamic_config
23
+ echo " rule: \"Host(\`waeb.localhost\`) || PathPrefix(\`/waeb\`)\"" >> $dynamic_config
24
  echo " service: noop@internal" >> $dynamic_config
25
  echo " middlewares:" >> $dynamic_config
26
  echo " - traefik-plugin-waeb" >> $dynamic_config
 
33
 
34
  echo "$services" | while read -r service; do
35
  name=$(echo $service | jq -r '.name')
36
+ port=$(echo $service | jq -r '.port')
37
  path_prefix=$(echo $service | jq -r '.path_prefix')
38
 
39
+ echo " $name:" >> $dynamic_config
40
+ echo " rule: \"PathPrefix(\`$path_prefix\`)\"" >> $dynamic_config
41
+ echo " service: $name" >> $dynamic_config
42
+ echo " priority: 2" >> $dynamic_config
43
+ echo " middlewares:" >> $dynamic_config
44
+ echo " - ${name}-stripprefix" >> $dynamic_config
45
+
46
+ # Waeb 服务添加特殊中间件
47
+ if [ "$name" == "waeb-service" ]; then
48
+ echo " - traefik-plugin-waeb" >> $dynamic_config
49
  fi
50
  done
51
 
 
76
 
77
  echo "$services" | while read -r service; do
78
  name=$(echo $service | jq -r '.name')
79
+ port=$(echo $service | jq -r '.port')
80
+
81
+ echo " $name:" >> $dynamic_config
82
+ echo " loadBalancer:" >> $dynamic_config
83
+ echo " servers:" >> $dynamic_config
84
+ echo " - url: \"http://localhost:$port\"" >> $dynamic_config
 
 
 
85
  done
86
  }
87