orztv commited on
Commit
d676c70
·
1 Parent(s): f45ed46
Files changed (2) hide show
  1. services.json +1 -1
  2. start.sh +13 -0
services.json CHANGED
@@ -12,7 +12,7 @@
12
  },
13
  {
14
  "name": "node-service",
15
- "command": "npx serve -s --listen $port --single",
16
  "port": 8001,
17
  "path_prefix": "/node",
18
  "health_check_path": "/",
 
12
  },
13
  {
14
  "name": "node-service",
15
+ "command": "npx serve -s --listen $port --single --cors",
16
  "port": 8001,
17
  "path_prefix": "/node",
18
  "health_check_path": "/",
start.sh CHANGED
@@ -33,6 +33,19 @@ generate_traefik_config() {
33
  echo " rule: \"PathPrefix(\`$path_prefix\`)\"" >> $dynamic_config
34
  echo " service: $name" >> $dynamic_config
35
  echo " priority: 2" >> $dynamic_config
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  done
37
 
38
  echo " services:" >> $dynamic_config
 
33
  echo " rule: \"PathPrefix(\`$path_prefix\`)\"" >> $dynamic_config
34
  echo " service: $name" >> $dynamic_config
35
  echo " priority: 2" >> $dynamic_config
36
+ echo " middlewares:" >> $dynamic_config
37
+ echo " - ${name}-stripprefix" >> $dynamic_config
38
+ done
39
+
40
+ echo " middlewares:" >> $dynamic_config
41
+ echo "$services" | while read -r service; do
42
+ name=$(echo $service | jq -r '.name')
43
+ path_prefix=$(echo $service | jq -r '.path_prefix')
44
+
45
+ echo " ${name}-stripprefix:" >> $dynamic_config
46
+ echo " stripPrefix:" >> $dynamic_config
47
+ echo " prefixes:" >> $dynamic_config
48
+ echo " - \"$path_prefix\"" >> $dynamic_config
49
  done
50
 
51
  echo " services:" >> $dynamic_config