server:
  port: 8080

spring:
  application:
    name: reading-platform
  profiles:
    active: dev
  servlet:
    multipart:
      max-file-size: 300MB
      max-request-size: 1500MB

# MyBatis-Plus Configuration
mybatis-plus:
  mapper-locations: classpath:mapper/**/*.xml
  type-aliases-package: com.reading.platform.entity
  configuration:
    map-underscore-to-camel-case: true
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  global-config:
    db-config:
      id-type: auto
      logic-delete-field: deleted
      logic-delete-value: 1
      logic-not-delete-value: 0

# JWT Configuration
jwt:
  secret: reading-platform-jwt-secret-key-must-be-at-least-256-bits-long
  expiration: 86400000  # 24 hours in milliseconds
  header: Authorization
  prefix: "Bearer "

# Knife4j Configuration
springdoc:
  swagger-ui:
    path: /swagger-ui.html
    tags-sorter: alpha
    operations-sorter: alpha
  api-docs:
    path: /v3/api-docs
  group-configs:
    - group: 'default'
      paths-to-match: '/**'
      packages-to-scan: com.reading.platform.controller

knife4j:
  enable: true
  setting:
    language: zh_cn

# Rate Limit Configuration
rate-limit:
  enabled: true
  default-time-window: 60
  default-max-requests: 1000
  # 限流规则
  rules:
    # 登录接口限流 - 防止暴力破解
    - pattern: "/api/v1/auth/login"
      time-window: 60
      max-requests: 10
    # 验证码接口限流 - 防止刷验证码
    - pattern: "/api/v1/auth/captcha"
      time-window: 60
      max-requests: 5
    # 短信接口限流 - 防止短信轰炸
    - pattern: "/api/v1/sms/**"
      time-window: 60
      max-requests: 3
    # 文件上传接口限流
    - pattern: "/api/v1/**/upload/**"
      time-window: 60
      max-requests: 30
  # 排除限流的接口
  exclude-patterns:
    - "/doc.html"
    - "/swagger-resources/**"
    - "/v3/api-docs/**"
    - "/webjars/**"
    - "/uploads/**"
