# 安全配置
security:
  # 验证码
  captcha:
    # 是否开启验证码
    enabled: true
    # 验证码类型 math 数组计算 char 字符验证
    type: char
    # 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: nexo-auth
          uri: lb://nexo-auth
          predicates:
            - Path=/auth/**
          filters:
            # 验证码处理
            - ValidateCodeFilter
            - StripPrefix=1
        # 代码生成
        - id: nexo-gen
          uri: lb://nexo-gen
          predicates:
            - Path=/code/**
          filters:
            - StripPrefix=1
        # 系统模块
        - id: nexo-system
          uri: lb://nexo-system
          predicates:
            - Path=/system/**
          filters:
            - StripPrefix=1
        # 资源服务
        - id: nexo-resource
          uri: lb://nexo-resource
          predicates:
            - Path=/resource/**
          filters:
            - StripPrefix=1
        # 演示服务
        - id: nexo-demo
          uri: lb://nexo-demo
          predicates:
            - Path=/demo/**
          filters:
            - StripPrefix=1
        # MQ演示服务
        - id: nexo-stream-mq
          uri: lb://nexo-stream-mq
          predicates:
            - Path=/stream-mq/**
          filters:
            - StripPrefix=1

    # sentinel 配置
    sentinel:
      filter:
        enabled: false
      # 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: gw-flow
