# ─────────────────────────────────────────────────────────────────────────────
# MySQL / production profile.
# Activate with: --spring.profiles.active=mysql
# ─────────────────────────────────────────────────────────────────────────────
spring:
  jpa:
    database: MYSQL
    show-sql: false
    hibernate:
      # Flyway owns all DDL; Hibernate only validates
      ddl-auto: validate

  # H2 console is OFF in production
  h2:
    console:
      enabled: false

  datasource:
    # Updated URL for MySQL 8: removed deprecated useSSL=false; use requireSSL for prod
    url: jdbc:mysql://127.0.0.1:3306/jiscuss?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
    username: root
    password: changeme_production
    # Updated driver class name for MySQL Connector/J 8+
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      min-idle: 5
      initial-size: 10
      max-active: 50
      max-wait: 5000
      validation-query: SELECT 1
      filter:
        stat:
          enabled: true
          db-type: mysql
          log-slow-sql: true
          slow-sql-millis: 2000
      web-stat-filter:
        enabled: true
        exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
        reset-enable: false
        # Druid UI is gated by Spring Security ROLE_ADMIN; built-in basic auth disabled
        allow: 127.0.0.1

  # Flyway for MySQL
  flyway:
    locations: classpath:db/migration
    url: ${spring.datasource.url}
    user: ${spring.datasource.username}
    password: ${spring.datasource.password}

server:
  port: 80
  forward-headers-strategy: FRAMEWORK
