# ================== Gateway 服务配置 (Docker) ==================
server:
  port: 8080

spring:
  application:
    name: gateway-service
  
  main:
    web-application-type: reactive
  
  cloud:
    nacos:
      config:
        enabled: false
    
    gateway:
      discovery:
        locator:
          enabled: false
      
      routes:
        - id: auth-service
          uri: lb://auth-service
          predicates:
            - Path=/urban-lifeline/auth/**
          filters:
            - StripPrefix=1
            - name: RequestRateLimiter
              args:
                redis-rate-limiter.replenishRate: 100
                redis-rate-limiter.burstCapacity: 200
        
        - id: system-service
          uri: lb://system-service
          predicates:
            - Path=/urban-lifeline/system/**
          filters:
            - StripPrefix=1
            
        - id: log-service
          uri: lb://log-service
          predicates:
            - Path=/urban-lifeline/log/**
          filters:
            - StripPrefix=1
        
        - id: file-service
          uri: lb://file-service
          predicates:
            - Path=/urban-lifeline/file/**
          filters:
            - StripPrefix=1
        
        - id: message-service
          uri: lb://message-service
          predicates:
            - Path=/urban-lifeline/message/**
          filters:
            - StripPrefix=1
        
        - id: bidding-service
          uri: lb://bidding-service
          predicates:
            - Path=/urban-lifeline/bidding/**
          filters:
            - StripPrefix=1
        
        - id: platform-service
          uri: lb://platform-service
          predicates:
            - Path=/urban-lifeline/platform/**
          filters:
            - StripPrefix=1
        
        - id: workcase-websocket
          uri: lb:ws://workcase-service
          predicates:
            - Path=/urban-lifeline/workcase/ws/**
          filters:
            - StripPrefix=1

        - id: workcase-service
          uri: lb://workcase-service
          predicates:
            - Path=/urban-lifeline/workcase/**
          filters:
            - StripPrefix=1
        
        - id: crontab-service
          uri: lb://crontab-service
          predicates:
            - Path=/urban-lifeline/crontab/**
          filters:
            - StripPrefix=1
        
        - id: ai-service
          uri: lb://ai-service
          predicates:
            - Path=/urban-lifeline/ai/**
          filters:
            - StripPrefix=1
      
      globalcors:
        cors-configurations:
          '[/**]':
            allowedOriginPatterns: "*"
            allowedMethods: [GET, POST, PUT, DELETE, OPTIONS]
            allowedHeaders: "*"
            allowCredentials: true
            maxAge: 3600

  data:
    redis:
      timeout: 5000ms
      lettuce:
        pool:
          max-active: 20
          max-wait: -1ms
          max-idle: 10
          min-idle: 5

auth:
  enabled: true
  token-header: Authorization
  token-prefix: "Bearer "
  login-path: /urban-lifeline/auth/login
  logout-path: /urban-lifeline/auth/logout
  captcha-path: /urban-lifeline/auth/captcha
  refresh-path: /urban-lifeline/auth/refresh
  whitelist:
    - /actuator/**
    - /v3/api-docs/**
    - /swagger-ui/**
    - /swagger-resources/**
    - /webjars/**
    - /doc.html
    - /favicon.ico
    - /error
    - /urban-lifeline/*/v3/api-docs/**
    - /urban-lifeline/*/swagger-ui/**
    - /urban-lifeline/file/download/**
    - /urban-lifeline/ai/chat/**
    - /urban-lifeline/system/guest/identify
    - /urban-lifeline/workcase/meeting/*/entry

management:
  endpoints:
    web:
      exposure:
        include: health,info,gateway
  endpoint:
    health:
      show-details: always
