server:
  port: 8081
  servlet:
    context-path: /schoolNewsServ
    encoding:
      charset: UTF-8
      enabled: true
      force: true
spring:
  application:
    name: school-news-admin
  
  # 数据源配置
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/school_news?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
    username: root
    password: 123456
    hikari:
      maximum-pool-size: 30
      minimum-idle: 10
      connection-timeout: 30000
      idle-timeout: 600000
      max-lifetime: 1800000
  
  # Redis配置
  data:
    redis:
      # Redis服务器地址
      host: localhost
      # Redis服务器端口
      port: 6379
      # Redis密码（如果没有设置密码，可以留空或注释掉）
      password: 123456
      # Redis数据库索引（0-15，默认为0）
      database: 0
      # 连接超时时间（毫秒）
      timeout: 10000
      # Lettuce连接池配置
      lettuce:
        pool:
          # 连接池最大连接数
          max-active: 50
          # 连接池最大阻塞等待时间（负值表示没有限制）
          max-wait: 3000
          # 连接池中的最大空闲连接
          max-idle: 20
          # 连接池中的最小空闲连接
          min-idle: 5
        # 关闭超时时间
        shutdown-timeout: 100ms

# 认证配置
school-news:
  auth:
    # JWT配置
    jwt-secret: schoolNewsSecretKeyForJWT2025SecureEnough
    jwt-expiration: 86400  # 24小时
    
    # 安全配置
    max-login-attempts: 5
    lockout-duration: 30   # 锁定30分钟
    
    # 免登录白名单
    white-list:
      - "/auth/login"
      - "/auth/logout" 
      - "/auth/captcha"
      - "/auth/health"
      - "/actuator/**"
      - "/swagger-ui/**"
      - "/v3/api-docs/**"
      - "/favicon.ico"
      - "/error"
      - "/public/**"
      - "/static/**"
      - "/file/download/**"


# 文件存储配置
file:
  storage:
    storages:
    - type: local
      enabled: true
      base-path: ../uploads

# MyBatis Plus配置
mybatis-plus:
  # 实体类扫描包
  type-aliases-package: org.xyzh.common.dto
  # mapper xml文件位置
  mapper-locations: classpath*:mapper/*.xml
  # 全局配置
  global-config:
    db-config:
      # 逻辑删除字段
      logic-delete-field: deleted
      logic-delete-value: 1
      logic-not-delete-value: 0
      # 字段填充策略
      insert-strategy: not_null
      update-strategy: not_null
      select-strategy: not_empty
  # SQL配置
  configuration:
    # 开启驼峰命名转换
    map-underscore-to-camel-case: true
    # 开启二级缓存
    cache-enabled: true
    # 打印SQL
    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl

# 日志配置
logging:
  config: classpath:log4j2-spring.xml
  charset:
    console: UTF-8
    file: UTF-8

# 管理端点配置
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,env
  endpoint:
    health:
      show-details: when-authorized
debug: true
