spring:
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true
          lower-case-service-id: true
      routes:
        - id: auth-service
          uri: lb://erp-auth
          predicates:
            - Path=/api/auth/**
          filters:
            - StripPrefix=1
        - id: user-service
          uri: lb://erp-user
          predicates:
            - Path=/api/user/**
          filters:
            - StripPrefix=1
        - id: order-service
          uri: lb://erp-order
          predicates:
            - Path=/api/order/**
          filters:
            - StripPrefix=1
        - id: product-service
          uri: lb://erp-product
          predicates:
            - Path=/api/product/**
          filters:
            - StripPrefix=1
        - id: warehouse-service
          uri: lb://erp-warehouse
          predicates:
            - Path=/api/warehouse/**
          filters:
            - StripPrefix=1
      default-filters:
        - DedupeResponseHeader=Vary Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_FIRST

# Sentinel Flow Rules
sentinel:
  gateway:
    flow-rules:
      - resource: /api/auth/**
        count: 200
        grade: 1
        strategy: 0
      - resource: /api/user/**
        count: 100
        grade: 1
        strategy: 0
      - resource: /api/order/**
        count: 100
        grade: 1
        strategy: 0
      - resource: /api/product/**
        count: 100
        grade: 1
        strategy: 0
      - resource: /api/warehouse/**
        count: 100
        grade: 1
        strategy: 0

# Redis Rate Limit Config
spring:
  redis:
    rate-limiter:
      replenish-rate: 100
      burst-capacity: 200
