houzhongjian
2024-07-23 d9f9ba31913bb9f5053ad78109e8a3c1c00f1e6a
iailab-cloud/iailab-gateway/src/main/resources/application.yaml
@@ -1,6 +1,17 @@
spring:
  application:
    name: gateway-server
  profiles:
    active: local
  main:
    allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
  config:
    import:
      - optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
      - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
  cloud:
    # Spring Cloud Gateway 配置项,对应 GatewayProperties 类
@@ -74,8 +85,29 @@
          uri: grayLb://iailab-monitor
          predicates:
            - Path=/iailab-monitor/**
        ## data-server 服务
        - id: data-admin-api # 路由的编号
          uri: grayLb://data-server
          predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
            - Path=/admin-api/data/**
          filters:
            - RewritePath=/admin-api/data/v3/api-docs, /v3/api-docs
        ## model-server 服务
        - id: model-admin-api # 路由的编号
          uri: grayLb://model-server
          predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
            - Path=/admin-api/model/**
          filters:
            - RewritePath=/admin-api/model/v3/api-docs, /v3/api-docs
      x-forwarded:
        prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
        prefix-enabled: true # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
server:
  port: 48080
logging:
  file:
    name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
knife4j:
  # 聚合 Swagger 文档,参考 https://doc.xiaominfo.com/docs/action/springcloud-gateway 文档
@@ -91,6 +123,12 @@
      - name: bpm-server
        service-name: bpm-server
        url: /admin-api/bpm/v3/api-docs
      - name: data-server
        service-name: data-server
        url: /admin-api/data/v3/api-docs
      - name: model-server
        service-name: model-server
        url: /admin-api/model/v3/api-docs
--- #################### 平台相关配置 ####################
iailab: