# Tomcat
server:
  port: 8080
  netty:
    max-initial-line-length: 16384

# Spring
spring:
  application:
    # 应用名称
    name: bd-gateway
  jackson:
    # 返回数据序列化时，如果为 null 则不进行返回
    default-property-inclusion: NON_NULL
  profiles:
    # 环境配置
    active: dev
  cloud:
    nacos:
      discovery:
        # 服务注册地址
        server-addr: @config.server-addr@
        username: @config.username@
        password: @config.password@
        namespace: @config.namespace@
      config:
        # 配置中心地址
        server-addr: @config.server-addr@
        username: @config.username@
        password: @config.password@
        namespace: @config.namespace@
        # 配置文件格式
        file-extension: yml
        # 共享配置
        shared-configs:
          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
          ## 业务模块依赖的公用配置（缓存、数据库、事务、mybatis-plus）
          - business-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
          ## 业务模块依赖的公用配置（缓存、数据库、事务、mybatis-plus）
          - business-gateway-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
    sentinel:
      enabled: false
      # 取消控制台懒加载
      eager: true
      transport:
        # 控制台地址
        dashboard: 127.0.0.1:8718
      # nacos配置持久化
      datasource:
        ds1:
          nacos:
            server-addr: @config.server-addr@
            dataId: sentinel-bd-gateway
            groupId: DEFAULT_GROUP
            data-type: json
            rule-type: flow
    # 网关配置
    gateway:
      discovery:
        locator:
          # 开启之后routes中的id只能用小写，不开启只能用大写
          lowerCaseServiceId: true
          # 开启从注册中心动态创建路由的功能，利用微服务名称进行路由
          enabled: true
      routes:
        # 系统模块
        # id 路由服务名称，唯一
        - id: bd-system
          # lb 开头代表负载后面名称为应用服务名称
          uri: lb://bd-system
          # 匹配方式。 path 路径匹配方式，以 /auth 开头的uri，才会走该路径处理
          predicates:
            - Path=/system/**, /home/**
          # 拦截器
          filters:
            - CacheRequestFilter
            - ValidateCodeFilter
            # 路径前缀删除过滤。请求 /system/login 实际访问system服务的 /login
            - StripPrefix=1
        # 会员模块
        - id: bd-member
          uri: lb://bd-member
          predicates:
            - Path=/member/**
          filters:
            - CacheRequestFilter
            - ValidateCodeFilter
            - StripPrefix=1
        # 三方模块
        - id: bd-third
          uri: lb://bd-third
          predicates:
            - Path=/pay/**, /sms/**, /third/**
          filters:
            - StripPrefix=1
        # 销售模块
        - id: bd-sale
          uri: lb://bd-sale
          predicates:
            - Path=/sale/**, /activity/**
          filters:
            - StripPrefix=1
        # 统计模块
        - id: bd-report
          uri: lb://bd-report
          predicates:
            - Path=/report/**
          filters:
            - StripPrefix=1
        # 奖金模块
        - id: bd-bonus
          uri: lb://bd-bonus
          predicates:
            - Path=/bonus/**
          filters:
            - StripPrefix=1
        # 供应链模块
        - id: bd-scm
          uri: lb://bd-scm
          predicates:
            - Path=/scm/**
          filters:
            - StripPrefix=1
# 安全配置
security:
  # 验证码
  captcha:
    enabled: true
    type: num
  # 防止XSS攻击
  xss:
    enabled: true
    excludeUrls:
      - /system/manage/notice/*
      - /sale/manage/wares/*
      - /system/manage/feedback/*
      - /system/manage/ho-enterprise-mission
      - /system/manage/ho-enterprise-news
      - /system/manage/ho-enterprise-style
      - /system/manage/ho-product-details
      - /member/manage/dealer/reject
      - /member/manage/maker-space/reject
      - /member/manage/super-studio/reject
      - /sale/manage/appletConfig/save
      - /sale/manage/appletConfig/update
      - /sale/manage/appletConfig/detail
      - /sale/api/appletConfig/detail
      - /activity/manage/policy/submit
      - /activity/manage/other-price-config/submit
  # 不校验白名单
  ignore:
    whites:
      # 登录退出相关
      - /system/auth/**
      - /member/auth/**
      - /system/api/area/provinceList
      - /system/api/country/list
      # 首页相关页面
      - /home/api/**
      # 找回密码相关
      - /member/api/sms/forget-verification
      - /member/api/member/forget-password
      # 获取点亮区域
      - /system/manage/area/get-light-area
      # 语种国际化
      - /system/pub/enums/get-languages

# 日志配置
logging:
  level:
    com.bd: debug
    org.springframework: warn
