server:
  port: 7011
  main:
    allow-bean-definition-overriding: true
    web-application-typpse: reactive

management:
  endpoints:
    web:
      exposure:
        include: prometheus,health
  metrics:
    tags:
      application: tuoheng-gateway

spring:
  application:
    name: tuoheng-gateway
  security:
    oauth2:
      resource-server:
        jwt:
          issuer-uri: https://${OIDC_DOMAIN_FULL}
  cloud:
    consul:
      host: ${CONSUL_NAME} # consul 所在服务地址
      port: 8500 # consul 服务端口
      discovery:
        enabled: true #默认true。Consul Discovery Client是否注册到注册中心。和register同时设置成false，就不需要起consul服务。
        register: true #是否将服务注册到Consul集群中心.。这个参数和上面的enabled参数同时设置成false，应用才不会注册注册中心，才可以不起consul服务！
        deregister: true #默认true，服务停止时注销服务，即从服务列表中删除。设置成false的话，？？？
        ## consul ip地址
        hostname: ${CONSUL_NAME}
        # 注册到consul的服务名称
        service-name: ${spring.application.name} # 服务提供者名称,注册在consul上面的名字，在consul的调用中，是通过此名字调用的。默认服务名,不要改
        instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID
        heartbeat:
          enabled: true
        prefer-ip-address: true #表示注册时使用IP而不是hostname
        health-check-path: /actuator/health #健康检查
        health-check-interval: 10s  #配置 Consul 健康检查频率，也就是心跳频率。
        health-check-timeout: 10s #健康检查超时
    gateway:
      httpclient:
        websocket:
          max-frame-payload-length: 10485760 # 单次通信提交最大数据库设置成10MB
      discovery:
        locator:
          lowerCaseServiceId: true
          enabled: true
      # 跨域设置
      globalcors:
        add-to-simple-url-handler-mapping: true
        cors-configurations:
          '[/**]':
            allowedOrigins:
              - "http://localhost:8001"
            allowedMethods:
              - "GET"
              - "POST"
              - "DELETE"
              - "PUT"
              - "OPTIONS"
            allowedHeaders: "*"
            allowCredentials: true
            maxAge: 360000
      routes:
      # 机场平台 platform服务
        - id: tuoheng-airport-admin
          uri: http://${AIRPORT_NAME}:9060
          predicates:
            - Path=/airport/admin/**
          filters:
            - StripPrefix=2
          metadata:
            response-timeout: 20000
            connect-timeout: 30000
        # 机场平台 platform服务 webSocket
        - id: tuoheng-airport-admin
          uri: ws://${AIRPORT_NAME}:9060
          predicates:
            - Path=/airport/socket/**
          filters:
            - StripPrefix=2
        # 后台管理
        - id: tuoheng-dsp-admin
          uri: http://dsp-admin:9014
          predicates:
            - Path=/api/admin/**
          filters:
            - StripPrefix=2
        # 网站服务
        - id: tuoheng-dsp-portal
          uri: http://dsp-portal:9017
          predicates:
            - Path=/api/portal/**
          filters:
            - StripPrefix=2
        # DSP小程序服务
        - id: tuoheng-dsp-miniprogram
          uri: http://dsp-mini:9016
          predicates:
            - Path=/api/miniprogram/**
          filters:
            - StripPrefix=2
        # DSP api服务
        - id: tuoheng-dsp-api
          uri: http://${DSP_API_NAME}:9015
          predicates:
            - Path=/api/web/**
          filters:
            - StripPrefix=2
        # DSP 巡检云
        - id: tuoheng-dsp-inspection
          uri: http://dsp-inspection:9018
          predicates:
            - Path=/api/inspection/**
          filters:
            - StripPrefix=2
      # hhz admin服务
        - id: tuoheng-hhz-admin
          uri: http://${HHZ_ADMIN_NAME}:9055
          predicates:
            - Path=/hhz/admin/**
          filters:
            - StripPrefix=2
        # hhz 小程序服务
        - id: tuoheng-hhz-api
          uri: http://${HHZ_API_NAME}:9056
          predicates:
            - Path=/hhz/api/**
          filters:
            - StripPrefix=2
        # business admin服务
        - id: tuoheng-business-admin
          uri: http://${BUSINESS_NAME}:9260
          predicates:
            - Path=/business/admin/**
          filters:
            - StripPrefix=2
        # business 小程序服务
  # Redis数据源
  redis:
    # 缓存库默认索引0
    database: 0
    # Redis服务器地址
    host: ${REDIS_NAME}
    # Redis服务器连接端口
    port: 6379
    # Redis服务器连接密码（默认为空）
    password:
    # 连接超时时间（毫秒）
    timeout: 6000
    # 默认的数据过期时间，主要用于shiro权限管理
    expire: 2592000
    jedis:
      pool:
        max-active: 1000  # 连接池最大连接数（使用负值表示没有限制）
        max-wait: -1      # 连接池最大阻塞等待时间（使用负值表示没有限制）
        max-idle: 10      # 连接池中的最大空闲连接
        min-idle: 1       # 连接池中的最小空闲连接
#security放行白名单配置
security:
  ignore:
    permitUrls: /api/system/demo/msg
    oauthUrls: /api/system/demo/hello,/api/portal/serviceInst/*/getServiceInstParam/*,/api/portal/serviceInst/*/getServiceInstCaseUrl/*,/api/portal/serviceInst/*/*/application,/api/portal/serviceInst/*/*/questionList,/api/miniprogram/serviceInst/*/getServiceInstParam/*,/api/miniprogram/serviceInst/*/getServiceInstCaseUrl/*,/api/miniprogram/serviceInst/*/*/application,/api/miniprogram/serviceInst/*/*/questionList

# 获取 apiUrl 可访问的 roleIdList
tuoheng:
  hhz-admin-perUrl: http://${HHZ_ADMIN_NAME}:9055/permission/getRoleIdList
  airport-admin-perUrl: http://${AIRPORT_NAME}:9060/permission/getRoleIdList
  freeway-admin-perUrl: http://freeway-admin:9117/permission/getRoleIdList
  waterway-admin-perUrl: https://waterway.t-aaron.com/permission/getRoleIdList
  airmonitor-admin-perUrl: http://airmonitor-admin:9130/permission/getRoleIdList
  weptsp-admin-perUrl: http://weptsp-admin:9140/permission/getRoleIdList
  telecomumale-admin-perUrl: http://telecomumale-admin:9150/permission/getRoleIdList
  alert-admin-perUrl: https://alert.t-aaron.com/permission/getRoleIdList
  spacetime-admin-perUrl: https://spacetime.t-aaron.com/permission/getRoleIdList
  digitaltwin-admin-perUrl: https://digitaltwin.t-aaron.com/permission/getRoleIdList
  dmp-admin-perUrl: https://dmp.t-aaron.com/permission/getRoleIdList
  lacs-admin-perUrl: https://lacs.t-aaron.com/permission/getRoleIdList