# 安全配置
security:
  # 验证码
  captcha:
    # 是否开启验证码
    enabled: true
    # 验证码类型 math 数组计算 char 字符验证
    type: MATH
    # line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
    category: CIRCLE
    # 数字验证码位数
    numberLength: 1
    # 字符验证码长度
    charLength: 4
  # 防止XSS攻击
  xss:
    enabled: true
    excludeUrls:
      - /system/notice
  # 不校验白名单
  ignore:
    whites:
      - /code
      - /auth/logout
      - /auth/login
      - /auth/smsLogin
      - /auth/xcxLogin
      - /auth/register
      - /resource/sms/code
      - /*/v3/api-docs
      - /csrf

spring:
  cloud:
    # 网关配置
    gateway:
      # 打印请求日志(自定义)
      requestLog: true
      discovery:
        locator:
          lowerCaseServiceId: true
          enabled: true
      routes:
        # 认证中心
        - id: ruoyi-auth
          uri: lb://ruoyi-auth
          predicates:
            - Path=/auth/**
          filters:
            # 验证码处理
            - ValidateCodeFilter
            - StripPrefix=1
        # 代码生成
        - id: ruoyi-gen
          uri: lb://ruoyi-gen
          predicates:
            - Path=/code/**
          filters:
            - StripPrefix=1
        # 系统模块
        - id: ruoyi-system
          uri: lb://ruoyi-system
          predicates:
            - Path=/system/**
          filters:
            - StripPrefix=1
        # 资源服务
        - id: ruoyi-resource
          uri: lb://ruoyi-resource
          predicates:
            - Path=/resource/**
          filters:
            - StripPrefix=1
        # 演示服务
        - id: ruoyi-demo
          uri: lb://ruoyi-demo
          predicates:
            - Path=/demo/**
          filters:
            - StripPrefix=1
        # MQ演示服务
        - id: ruoyi-stream-mq
          uri: lb://ruoyi-stream-mq
          predicates:
            - Path=/stream-mq/**
          filters:
            - StripPrefix=1

    # sentinel 配置
    sentinel:
      # nacos配置持久化
      datasource:
        ds1:
          nacos:
            server-addr: ${spring.cloud.nacos.server-addr}
            dataId: sentinel-${spring.application.name}.json
            groupId: ${spring.cloud.nacos.config.group}
            namespace: ${spring.profiles.active}
            data-type: json
            rule-type: flow