spring:
  application:
    name: xl-prison-server

  # 数据源配置（使用新建的 MySQL 容器）
  datasource:
    dynamic:
      datasource:
        master:
          # 使用 Docker 服务名连接 MySQL
          url: jdbc:mysql://mysql:3306/prison?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf8
          username: root
          password: Prison2024!@
          driver-class-name: com.mysql.cj.jdbc.Driver
        slave:
          # 从库配置（可选，如果不需要可以删除或保持与主库相同）
          url: jdbc:mysql://mysql:3306/prison?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf8
          username: root
          password: Prison2024!@
          driver-class-name: com.mysql.cj.jdbc.Driver
      hikari:
        # 连接池配置
        maximum-pool-size: 20
        minimum-idle: 5
        idle-timeout: 600000
        connection-timeout: 30000
        max-lifetime: 1800000
        pool-name: PrisonHikariCP
        # 连接健康检测
        connection-test-query: SELECT 1

  # Redis 配置（使用新建的 Redis 容器）
  data:
    redis:
      host: redis
      port: 6379
      password: Prison2024!@
      database: 0
      timeout: 10000ms
      lettuce:
        pool:
          max-active: 20
          max-wait: -1ms
          max-idle: 10
          min-idle: 0
        shutdown-timeout: 100ms

  # 文件上传配置
  servlet:
    multipart:
      enabled: true
      max-file-size: 100MB
      max-request-size: 100MB
      file-size-threshold: 2KB

  # Jackson 配置
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8
    serialization:
      write-dates-as-timestamps: false

# 服务器配置
server:
  port: 48080
  servlet:
    context-path: /
    compression:
      enabled: true
      mime-types: application/json,application/xml,text/html,text/xml,text/plain
    error:
      include-message: always
      include-binding-errors: always

# 应用配置
app:
  name: XL监狱综合管理平台
  version: 1.0.0

  # 验证码配置
  captcha:
    enabled: true
    type: math

  # 文件上传配置
  upload:
    path: ./data/upload
    avatar-path: ./data/upload/avatar
    cache-path: ./data/upload/cache

  # XSS 过滤配置
  security:
    xss:
      enabled: true
      exclude-urls:
        - /admin/ck/uploadImage
        - /admin/oss/uploadToAliCloudV2
        - /admin/oss/uploadToTencentCloudV2

# 日志配置
logging:
  level:
    root: INFO
    cn.iocoder.yudao: DEBUG
    cn.iocoder.yudao.module.prison: DEBUG
  file:
    name: logs/yudao-server.log
  logback:
    rollingpolicy:
      max-history: 30
      max-file-size: 100MB
      total-size-cap: 3GB

# MyBatis Plus 配置
mybatis-plus:
  mapper-locations: classpath*:mapper/**/*.xml
  type-aliases-package: cn.iocoder.yudao.module.*.dal.dataobject
  global-config:
    db-config:
      id-type: auto
      logic-delete-field: deleted
      logic-delete-value: 1
      logic-not-delete-value: 0
    banner: false
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: false
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

# Actuator 监控配置
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
      base-path: /actuator
  endpoint:
    health:
      show-details: always
  metrics:
    tags:
      application: ${spring.application.name}

# LLM 配置（用于危险评估智能分析）
llm:
  local:
    base-url: ${LLM_BASE_URL:http://127.0.0.1:5001/v1}
    api-key: ${LLM_API_KEY:}
    model: ${LLM_MODEL:}
    timeout-seconds: ${LLM_TIMEOUT:120}
