server:
  port: 8005

spring:
  profiles:
    active: test
  application:
    name: liankong-gateway-server
  cloud:
    nacos:
      discovery:
        server-addr: nacos.scfile.cn:8848
        namespace: liankong
        username: liankong
        password: liankong2020
#      config:
#        file-extension: yaml
#        server-addr: 39.107.107.60:8848
#        namespace: liankong
#        username: liankong
#        password: liankong2020
#        group: v1
    #全局超时设置
    httpclient:
      connect-timeout: 5000
      response-timeout: 5s

    gateway:
#      discovery:
#        locator:
#          enabled: true

      routes:
        # 文档服务
        - id: liankong-service-document
          uri: lb://liankong-service-document
          predicates:
            - Path=/document/**

        # 打印服务
        - id: liankong-print-server
          uri: lb://liankong-print-server
          predicates:
            - Path=/printer/**, /agent/**

        # 消息服务
        - id: liankong-service-message
          uri: lb://liankong-service-message
          predicates:
            - Path=/msg/mail/**, /msg/send/mail, /msg/send/message,/msg/user/**
          filters:
            - RewritePath=/msg/(?<segment>.*), /$\{segment}

        # 阅读服务
        - id: liankong-service-reader
          uri: lb://liankong-service-reader
          predicates:
            - Path=/screader/**, /fs/**, /home/**
          filters:
            - RewritePath=/screader/(?<segment>.*), /$\{segment}

        # 分享服务
        - id: liankong-share-server
          uri: lb://liankong-service-share
          predicates:
            - Path=/share/**, /water/**, /home/**, /fs/**

        - id: liankong-share-server-ws
          uri: lb:ws://liankong-service-share
          predicates:
            - Path=/ws/**

        # 用户认证服务
        - id: liankong-user-auth
          uri: lb://liankong-user-auth
          predicates:
            - Path=/auth/**
          filters:
            - RewritePath=/auth/(?<segment>.*), /$\{segment}
            - ValidateCodeGatewayFilter

        # 用户信息服务
        - id: liankong-user-service
          uri: lb://liankong-user-service
          predicates:
            - Path=/usercenter/**
          filters:
            - RewritePath=/usercenter/(?<segment>.*), /$\{segment}

        # 测试服务
        - id: test
          uri: lb://provider
          predicates:
            #请求方法匹配
            - Method=GET,POST
            #请求方法匹配，可设置多个
            - Path=/echo/{segment},/echo/iopw
            #请求头匹配设置两个参数，正则
            #            - Header=X-Request-Id, \d+
            #参数匹配，可以携带正则，red=green red=greentdadf等，参数名和值
          #            - Query=red, gree.
          filters:
            - AddRequestHeader=X-Request-red, blue
#            - Authorize=true
            - name: RequestRateLimiter
              args:
                redis-rate-limiter.replenishRate: 1
                redis-rate-limiter.burstCapacity: 2
                key-resolver: '#{@hostAddrKeyResolver}'

  redis:
    pool:
      max-active: 20
      max-wait: 1
      max-idle: 5
      min-idle: 5
    timeout: 10000

management:
  endpoints:
    web:
      exposure:
        include: "*"
