orztv
commited on
Commit
·
5cb6df4
1
Parent(s):
2457f41
update
Browse files
start.sh
CHANGED
@@ -20,7 +20,7 @@ generate_traefik_config() {
|
|
20 |
|
21 |
# 添加 Waeb 路由器
|
22 |
echo " waeb-router:" >> $dynamic_config
|
23 |
-
echo " rule: \"
|
24 |
echo " service: noop@internal" >> $dynamic_config
|
25 |
echo " middlewares:" >> $dynamic_config
|
26 |
echo " - traefik-plugin-waeb" >> $dynamic_config
|
@@ -33,19 +33,17 @@ 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')
|
37 |
path_prefix=$(echo $service | jq -r '.path_prefix')
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
if [ "$name" == "waeb-service" ]; then
|
48 |
-
echo " - traefik-plugin-waeb" >> $dynamic_config
|
49 |
fi
|
50 |
done
|
51 |
|
@@ -76,12 +74,15 @@ generate_traefik_config() {
|
|
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 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
85 |
done
|
86 |
}
|
87 |
|
|
|
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 |
|
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 |
|
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 |
|