dengzedong
6 天以前 a6e46fe2b5729e7468b6f3c4e079232801c22520
提交 | 用户 | 时间
e7c126 1 spring:
d9f9ba 2   application:
H 3     name: gateway-server
4
e7c126 5   main:
H 6     allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
4a47e4 7
H 8   profiles:
9     active: @profiles.active@
d9f9ba 10
H 11   config:
12     import:
13       - optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
14       - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
e7c126 15
H 16   cloud:
4a47e4 17     nacos:
H 18       server-addr: @nacos.server@ # Nacos 服务器地址
19       username: @nacos.username@
20       password: @nacos.password@
21       discovery: # 【配置中心】配置项
22         namespace: @profiles.active@
23         group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
24         metadata:
25           version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布
26           management.context-path: ${server.servlet.context-path}/actuator
27       config: # 【注册中心】配置项
28         namespace: @profiles.active@
29         group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
30
e7c126 31     # Spring Cloud Gateway 配置项,对应 GatewayProperties 类
H 32     gateway:
33       # 路由配置项,对应 RouteDefinition 数组
34       routes:
35         ## system-server 服务
36         - id: system-admin-api # 路由的编号
37           uri: grayLb://system-server
38           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
39             - Path=/admin-api/system/**
40           filters:
41               - RewritePath=/admin-api/system/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
42         - id: system-app-api # 路由的编号
43           uri: grayLb://system-server
44           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
45             - Path=/app-api/system/**
46           filters:
47               - RewritePath=/app-api/system/v3/api-docs, /v3/api-docs
48         ## infra-server 服务
49         - id: infra-admin-api # 路由的编号
50           uri: grayLb://infra-server
51           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
52             - Path=/admin-api/infra/**
53           filters:
54               - RewritePath=/admin-api/infra/v3/api-docs, /v3/api-docs
55         - id: infra-app-api # 路由的编号
56           uri: grayLb://infra-server
57           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
58             - Path=/app-api/infra/**
59           filters:
60               - RewritePath=/app-api/infra/v3/api-docs, /v3/api-docs
61         - id: infra-spring-boot-admin # 路由的编号(Spring Boot Admin)
62           uri: grayLb://infra-server
63           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
64             - Path=/admin/**
65         - id: infra-websocket # 路由的编号(WebSocket)
66           uri: grayLb://infra-server
67           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
68             - Path=/infra/ws/**
69         ## bpm-server 服务
70         - id: bpm-admin-api # 路由的编号
71           uri: grayLb://bpm-server
72           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
73             - Path=/admin-api/bpm/**
74           filters:
75               - RewritePath=/admin-api/bpm/v3/api-docs, /v3/api-docs
76         ## report-server 服务
77         - id: report-admin-api # 路由的编号
78           uri: grayLb://report-server
79           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
80             - Path=/admin-api/report/**
81           filters:
82             - RewritePath=/admin-api/report/v3/api-docs, /v3/api-docs
83         - id: report-jimu # 路由的编号(积木报表)
84           uri: grayLb://report-server
85           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
874287 86             - Path=/jmreport/**, /drag/**
e7c126 87         ## statistics-server 服务
H 88         - id: statistics-admin-api # 路由的编号
89           uri: grayLb://statistics-server
90           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
91             - Path=/admin-api/statistics/**
92           filters:
93             - RewritePath=/admin-api/statistics/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
325d2f 94         ## xxl-job
H 95         - id: xxl-job-admin
96           uri: grayLb://xxl-job-server
e7c126 97           predicates:
325d2f 98             - Path=/xxl-job-admin/**
H 99         ## monitor
e7c126 100         - id: monitor-server
325d2f 101           uri: grayLb://monitor-server
e7c126 102           predicates:
H 103             - Path=/iailab-monitor/**
d9f9ba 104         ## data-server 服务
H 105         - id: data-admin-api # 路由的编号
106           uri: grayLb://data-server
107           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
108             - Path=/admin-api/data/**
109           filters:
110             - RewritePath=/admin-api/data/v3/api-docs, /v3/api-docs
111         ## model-server 服务
112         - id: model-admin-api # 路由的编号
113           uri: grayLb://model-server
114           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
115             - Path=/admin-api/model/**
116           filters:
117             - RewritePath=/admin-api/model/v3/api-docs, /v3/api-docs
ce910c 118         ## shasteel 服务
H 119         - id: shasteel-admin-api # 路由的编号
120           uri: grayLb://shasteel-server
121           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
122             - Path=/admin-api/shasteel/**
123           filters:
124             - RewritePath=/admin-api/shasteel/v3/api-docs, /v3/api-docs
bb2880 125         ## xmcpms 服务
H 126         - id: xmcpms-admin-api # 路由的编号
127           uri: grayLb://xmcpms-server
128           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
129             - Path=/admin-api/xmcpms/**
130           filters:
131             - RewritePath=/admin-api/xmcpms/v3/api-docs, /v3/api-docs
132         ## xmcsms 服务
133         - id: xmcsms-admin-api # 路由的编号
134           uri: grayLb://xmcsms-server
135           predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
136             - Path=/admin-api/xmcsms/**
137           filters:
138             - RewritePath=/admin-api/xmcsms/v3/api-docs, /v3/api-docs
e7c126 139       x-forwarded:
d9f9ba 140         prefix-enabled: true # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
H 141
142 server:
143   port: 48080
ce910c 144   servlet:
961a64 145     context-path: /
ce910c 146     session:
H 147       timeout: 120s
d9f9ba 148
H 149 logging:
150   file:
4a47e4 151     name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径
e7c126 152
H 153 knife4j:
154   # 聚合 Swagger 文档,参考 https://doc.xiaominfo.com/docs/action/springcloud-gateway 文档
155   gateway:
156     enabled: true
157     routes:
158       - name: system-server
159         service-name: system-server
160         url: /admin-api/system/v3/api-docs
161       - name: infra-server
162         service-name: infra-server
163         url: /admin-api/infra/v3/api-docs
164       - name: bpm-server
165         service-name: bpm-server
166         url: /admin-api/bpm/v3/api-docs
d9f9ba 167       - name: data-server
H 168         service-name: data-server
169         url: /admin-api/data/v3/api-docs
170       - name: model-server
171         service-name: model-server
172         url: /admin-api/model/v3/api-docs
874287 173       - name: report-server
H 174         service-name: report-server
175         url: /admin-api/report/v3/api-docs
e7c126 176 --- #################### 平台相关配置 ####################
H 177
178 iailab:
179   info:
180     version: 1.0.0
181
182 # 服务端点检查
183 management:
184   trace:
185     http:
186       enabled: true
187   endpoints:
188     web:
189       exposure:
190         include: "*"
191   endpoint:
192     health:
4a47e4 193       show-details: always
H 194
195 # 日志文件配置
196 logging:
197   level:
198     org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示