houzhongjian
2024-12-03 874287a4c02d0a980d8b97c4a691b4f37ec5e812
提交 | 用户 | 时间
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
e7c126 125       x-forwarded:
d9f9ba 126         prefix-enabled: true # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
H 127
128 server:
129   port: 48080
ce910c 130   servlet:
H 131     session:
132       timeout: 120s
d9f9ba 133
H 134 logging:
135   file:
4a47e4 136     name: @log.path@/logs/${spring.application.name}.log # 日志文件名,全路径
e7c126 137
H 138 knife4j:
139   # 聚合 Swagger 文档,参考 https://doc.xiaominfo.com/docs/action/springcloud-gateway 文档
140   gateway:
141     enabled: true
142     routes:
143       - name: system-server
144         service-name: system-server
145         url: /admin-api/system/v3/api-docs
146       - name: infra-server
147         service-name: infra-server
148         url: /admin-api/infra/v3/api-docs
149       - name: bpm-server
150         service-name: bpm-server
151         url: /admin-api/bpm/v3/api-docs
d9f9ba 152       - name: data-server
H 153         service-name: data-server
154         url: /admin-api/data/v3/api-docs
155       - name: model-server
156         service-name: model-server
157         url: /admin-api/model/v3/api-docs
874287 158       - name: report-server
H 159         service-name: report-server
160         url: /admin-api/report/v3/api-docs
e7c126 161 --- #################### 平台相关配置 ####################
H 162
163 iailab:
164   info:
165     version: 1.0.0
166
167 # 服务端点检查
168 management:
169   trace:
170     http:
171       enabled: true
172   endpoints:
173     web:
174       exposure:
175         include: "*"
176   endpoint:
177     health:
4a47e4 178       show-details: always
H 179
180 # 日志文件配置
181 logging:
182   level:
183     org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示