server:
  port: 80

# 需要配置的服务名
blade:
  service:
    blade-auth: blade-auth
    blade-desk: blade-desk
    blade-system: blade-system

spring:
  cloud:
    gateway:
      routes:
      # 认证中心
      - id: ${blade.service.blade-auth}
        uri: lb://${blade.service.blade-auth}
        predicates:
        - Path=/${blade.service.blade-auth}/**
        filters:
        - name: RequestRateLimiter
          args:
            # 使用SpEL按名称引用bean
            key-resolver: '#{@remoteAddrKeyResolver}'
            # 允许用户每秒处理多少个请求
            redis-rate-limiter.replenishRate: 10
            # 允许在一秒钟内完成的最大请求数
            redis-rate-limiter.burstCapacity: 20
        - StripPrefix=1
      # 首页模块
      - id: ${blade.service.blade-desk}
        uri: lb://${blade.service.blade-desk}
        predicates:
        - Path=/${blade.service.blade-desk}/**
      # 系统模块
      - id: ${blade.service.blade-system}
        uri: lb://${blade.service.blade-system}
        predicates:
        - Path=/${blade.service.blade-system}/**
      discovery:
        locator:
          enabled: true
    loadbalancer:
      retry:
        enabled: true

#feign配置
feign:
  hystrix:
    enabled: true
  okhttp:
    enabled: true
  httpclient:
    enabled: false

#hystrix配置
hystrix:
  threadpool:
    default:
      coreSize: 300
      maxQueueSize: 1000
      queueSizeRejectionThreshold: 800
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 720000

#ribbon配置
ribbon:
  #对当前实例的重试次数
  MaxAutoRetries: 1
  #切换实例的重试次数
  MaxAutoRetriesNextServer: 2
  #请求处理的超时时间
  ReadTimeout: 60000
  #请求连接的超时时间
  ConnectTimeout: 60000
  #对所有操作请求都进行重试
  OkToRetryOnAllOperations: true

#对外暴露端口
management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: always
