# =================== 开发环境配置 ===================
spring:
  config:
    activate:
      on-profile: dev

  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
#    url: jdbc:mysql://${DB_HOST:8.148.151.56}:${DB_PORT:3306}/reading_platform?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
    url: jdbc:mysql://${DB_HOST:192.168.1.250}:${DB_PORT:3306}/reading_platform?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
    username: ${DB_USERNAME:reading_platform}
    password: ${DB_PASSWORD:reading_platform_pwd}
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      initial-size: 5
      min-idle: 5
      max-active: 20
      max-wait: 60000
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      validation-query: SELECT 1
      test-while-idle: true
      test-on-borrow: false
      test-on-return: false
      pool-prepared-statements: true
      max-pool-prepared-statement-per-connection-size: 20
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
        reset-enable: false
        login-username: admin
        login-password: admin
      web-stat-filter:
        enabled: true
        url-pattern: /*
        exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
  data:
    redis:
#      host: ${REDIS_HOST:8.148.151.56}
      host: ${REDIS_HOST:192.168.1.250}
      port: ${REDIS_PORT:6379}
      password: ${REDIS_PASSWORD:QWErty123}
      database: 4
      timeout: 30000ms  # 增加到 30 秒，避免网络延迟导致超时
      lettuce:
        pool:
          max-active: 16  # 增加连接池大小
          max-wait: 10000ms
          max-idle: 16
          min-idle: 4

  flyway:
    enabled: true  # Flyway 修复后重新启用
    locations: classpath:db/migration
    clean-disabled: false
    validate-on-migrate: false
    baseline-on-migrate: true
    baseline-version: 0
    clean-on-validation-error: true
    out-of-order: true

# MyBatis-Plus 配置
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

# JWT 配置（开发环境 - 使用默认密钥）
jwt:
  secret: ${JWT_SECRET:dev-secret-key-for-development-only-reading-platform-2024}
  expiration: ${JWT_EXPIRATION:86400000}

# 阿里云 OSS 配置（开发环境）
aliyun:
  oss:
    endpoint: ${OSS_ENDPOINT:oss-cn-shenzhen.aliyuncs.com}
    access-key-id: ${OSS_ACCESS_KEY_ID:LTAI5tKZhPofbThbSzDSiWoK}
    access-key-secret: ${OSS_ACCESS_KEY_SECRET:FtcsC7oQX3T0NaChaa9FYq2aoysQFM}
    bucket-name: ${OSS_BUCKET_NAME:lesingle-kid-course}
    max-file-size: ${OSS_MAX_FILE_SIZE:10485760}
    # 前端直传跨域：启动时自动配置 OSS CORS
    cors-enabled: ${OSS_CORS_ENABLED:true}
    cors-allowed-origins: ${OSS_CORS_ORIGINS:*}
  imm:
    endpoint: ${IMM_ENDPOINT:imm.cn-shenzhen.aliyuncs.com}
    region: ${IMM_REGION:cn-shenzhen}
    project-name: ${IMM_PROJECT_NAME:kid-course-platform-doc}
    access-key-id: ${IMM_ACCESS_KEY_ID:LTAI5tKZhPofbThbSzDSiWoK}
    access-key-secret: ${IMM_ACCESS_KEY_SECRET:FtcsC7oQX3T0NaChaa9FYq2aoysQFM}

# 日志配置（开发环境 - DEBUG 级别）
logging:
  level:
    root: INFO
    com.lesingle.edu: DEBUG
    com.baomidou.mybatisplus: DEBUG
    org.springframework: WARN
