houzhongyi
2024-07-11 e7c1260db32209a078a962aaa0ad5492c35774fb
提交 | 用户 | 时间
e7c126 1 spring:
H 2   main:
3     allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
4
5   cloud:
6     # Spring Cloud Gateway 配置项,对应 GatewayProperties 类
7     gateway:
8       # 路由配置项,对应 RouteDefinition 数组
9       routes:
10         ## system-server 服务
11         - id: system-admin-api # 路由的编号
12           uri: grayLb://system-server
13           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
14             - Path=/admin-api/system/**
15           filters:
16               - RewritePath=/admin-api/system/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
17         - id: system-app-api # 路由的编号
18           uri: grayLb://system-server
19           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
20             - Path=/app-api/system/**
21           filters:
22               - RewritePath=/app-api/system/v3/api-docs, /v3/api-docs
23         ## infra-server 服务
24         - id: infra-admin-api # 路由的编号
25           uri: grayLb://infra-server
26           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
27             - Path=/admin-api/infra/**
28           filters:
29               - RewritePath=/admin-api/infra/v3/api-docs, /v3/api-docs
30         - id: infra-app-api # 路由的编号
31           uri: grayLb://infra-server
32           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
33             - Path=/app-api/infra/**
34           filters:
35               - RewritePath=/app-api/infra/v3/api-docs, /v3/api-docs
36         - id: infra-spring-boot-admin # 路由的编号(Spring Boot Admin)
37           uri: grayLb://infra-server
38           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
39             - Path=/admin/**
40         - id: infra-websocket # 路由的编号(WebSocket)
41           uri: grayLb://infra-server
42           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
43             - Path=/infra/ws/**
44         ## bpm-server 服务
45         - id: bpm-admin-api # 路由的编号
46           uri: grayLb://bpm-server
47           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
48             - Path=/admin-api/bpm/**
49           filters:
50               - RewritePath=/admin-api/bpm/v3/api-docs, /v3/api-docs
51         ## report-server 服务
52         - id: report-admin-api # 路由的编号
53           uri: grayLb://report-server
54           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
55             - Path=/admin-api/report/**
56           filters:
57             - RewritePath=/admin-api/report/v3/api-docs, /v3/api-docs
58         - id: report-jimu # 路由的编号(积木报表)
59           uri: grayLb://report-server
60           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
61             - Path=/jmreport/**
62         ## statistics-server 服务
63         - id: statistics-admin-api # 路由的编号
64           uri: grayLb://statistics-server
65           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
66             - Path=/admin-api/statistics/**
67           filters:
68             - RewritePath=/admin-api/statistics/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
69         - id: xxl-job-server
70           uri: grayLb://iailab-job
71           predicates:
72             - Path=/iailab-job/**
73         - id: monitor-server
74           uri: grayLb://iailab-monitor
75           predicates:
76             - Path=/iailab-monitor/**
77       x-forwarded:
78         prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
79
80 knife4j:
81   # 聚合 Swagger 文档,参考 https://doc.xiaominfo.com/docs/action/springcloud-gateway 文档
82   gateway:
83     enabled: true
84     routes:
85       - name: system-server
86         service-name: system-server
87         url: /admin-api/system/v3/api-docs
88       - name: infra-server
89         service-name: infra-server
90         url: /admin-api/infra/v3/api-docs
91       - name: bpm-server
92         service-name: bpm-server
93         url: /admin-api/bpm/v3/api-docs
94 --- #################### 平台相关配置 ####################
95
96 iailab:
97   info:
98     version: 1.0.0
99
100 # 服务端点检查
101 management:
102   trace:
103     http:
104       enabled: true
105   endpoints:
106     web:
107       exposure:
108         include: "*"
109   endpoint:
110     health:
111       show-details: always