# ─────────────────────────────────────────────────────────────────────────────
# Default configuration — shared across all profiles.
# Profile-specific overrides live in application-h2.yml and application-mysql.yml.
# ─────────────────────────────────────────────────────────────────────────────
spring:
  # Ehcache 3 via JCache (JSR-107) — replaces Ehcache 2 (net.sf.ehcache)
  cache:
    type: jcache
    jcache:
      config: classpath:ehcache3.xml

  jpa:
    generate-ddl: false
    show-sql: false
    hibernate:
      # ddl-auto=validate lets Hibernate check that the schema matches entities
      # without modifying anything; Flyway owns all DDL.
      ddl-auto: validate

  freemarker:
    suffix: .ftl
    content-type: text/html
    charset: UTF-8
    cache: false
    template-loader-path:
      - classpath:/templates
    settings:
      classic_compatible: true

  mvc:
    static-path-pattern: /static/**

  # Disable legacy spring.datasource.schema / spring.datasource.data initialisation;
  # Flyway handles all schema setup in db/migration/.
  sql:
    init:
      mode: never

  # Expose Flyway information via Actuator (read-only)
  flyway:
    enabled: true
    baseline-on-migrate: true  # safe for existing databases without flyway_schema_history

# Actuator: expose health + info publicly; restrict all other endpoints to ROLE_ADMIN
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,flyway
  endpoint:
    health:
      show-details: when-authorized

# Forward header strategy — set to NATIVE when running behind a trusted reverse proxy
# so Spring uses X-Forwarded-* headers for request URL/IP resolution.
server:
  port: 80
  forward-headers-strategy: NONE  # change to NATIVE behind a trusted proxy

# SpringDoc OpenAPI — UI at /swagger-ui/index.html
springdoc:
  swagger-ui:
    path: /swagger-ui.html
  api-docs:
    path: /v3/api-docs
