refactor(consul): 统一Traefik路由配置格式并更新whoami服务配置

- 将Traefik路由规则从下划线格式改为点分隔格式
- 更新whoami服务配置,使用tags替代meta并添加中间件配置
- 修复user-service和recommend-service中的拼写错误
This commit is contained in:
fanfpy 2025-07-01 15:43:01 +08:00
parent e580872158
commit f7cdfcbd1d
7 changed files with 21 additions and 13 deletions

View File

@ -9,7 +9,7 @@
"id": "data-service-1",
"meta": {
"traefik_enable": "true",
"traefik_http_routers_data_service_rule": "PathPrefix('/api/data')"
"traefik.http.routers.data-service.rule": "PathPrefix('/api/data')"
},
"name": "data-service",
"port": 8000

View File

@ -9,7 +9,7 @@
"id": "emotion-service-1",
"meta": {
"traefik_enable": "true",
"traefik_http_routers_emotion_service_rule": "PathPrefix(`/api/emotion`)"
"traefik.http.routers.emotion-service.rule": "PathPrefix('/api/emotion')"
},
"name": "emotion-service",
"port": 8002

View File

@ -9,7 +9,7 @@
"id": "frontend-1",
"meta": {
"traefik_enable": "true",
"traefik_http_routers_frontend_rule": "PathPrefix(`/`)"
"traefik.http.routers.frontend.rule": "PathPrefix('/')"
},
"name": "frontend",
"port": 80

View File

@ -9,7 +9,7 @@
"id": "quant-service-1",
"meta": {
"traefik_enable": "true",
"traefik_http_routers_quant_service_rule": "PathPrefix(`/api/quant`)"
"traefik.http.routers.quant-service.rule": "PathPrefix('/api/quant')"
},
"name": "quant-service",
"port": 8001

View File

@ -9,7 +9,7 @@
"id": "recommend-service-1",
"meta": {
"traefik_enable": "true",
"traefik_http_routers_recommend_service_rule": "PathPrefix(`/api/recommend`)"
"raefik.http.routers.quant-service.rule": "PathPrefix(`/api/recommend`)"
},
"name": "recommend-service",
"port": 8003

View File

@ -9,7 +9,7 @@
"id": "user-service-1",
"meta": {
"traefik_enable": "true",
"traefik_http_routers_user_service_rule": "PathPrefix(`/api/user`)"
"raefik.http.routers.quant-service.rule": "PathPrefix(`/api/user`)"
},
"name": "user-service",
"port": 8004

View File

@ -1,15 +1,23 @@
{
"service": {
"name": "whoami",
"address": "whoami",
"port": 80,
"meta": {
"traefik_enable": "true",
"traefik_http_routers_whoami_rule": "PathPrefix(`/whoami`)",
"traefik_http_routers_whoami_entrypoints": "web"
},
"tags": [
"traefik.enable=true",
"traefik.http.routers.whoami.rule=Host(`whoami.localhost`)",
"traefik.http.routers.whoami.entrypoints=web",
"traefik.http.routers.whoami.middlewares=whoami-prefix"
],
"check": {
"http": "http://whoami:80",
"http": "http://whoami:80/",
"interval": "10s"
}
},
"middleware": {
"name": "whoami-prefix",
"pathPrefixStrip": {
"prefixes": ["/whoami"]
}
}
}
}