application-prod.yml 2.01 KB
spring:
  config:
    activate:
      on-profile: prod
  
  # 生产环境数据库配置
  datasource:
    url: jdbc:postgresql://postgresql-service:5432/ecommerce
    username: ${DB_USERNAME:admin}
    password: ${DB_PASSWORD}
    hikari:
      maximum-pool-size: 10
      minimum-idle: 2
      connection-timeout: 30000
      idle-timeout: 600000
      max-lifetime: 1800000
  
  # 生产环境 Flyway 配置
  flyway:
    validate-on-migrate: true
    out-of-order: false
    repair-on-migrate: true
    ignore-missing-migrations: true
    ignore-future-migrations: true
  
  # 生产环境 JPA 配置
  jpa:
    hibernate:
      ddl-auto: validate
    properties:
      hibernate:
        show_sql: false
        format_sql: false
        jdbc:
          batch_size: 20
        order_inserts: true
        order_updates: true
  
  # 生产环境 Redis 配置
  redis:
    host: redis-service
    port: 6379
    timeout: 5000
    lettuce:
      pool:
        max-active: 1
        max-idle: 1
        min-idle: 1
        max-wait: 5000ms

# 生产环境服务器配置
server:
  port: 8080
  servlet:
    context-path: /api
  compression:
    enabled: true
    mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
    min-response-size: 1024

# 生产环境管理端点
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics
      base-path: /management
  endpoint:
    health:
      show-details: when_authorized
      show-components: when_authorized
    metrics:
      enabled: true

# 生产环境日志配置
logging:
  level:
    com.ecommerce.product: INFO
    org.hibernate: WARN
    org.springframework: INFO
    org.flywaydb: INFO
  file:
    name: /var/log/product-service/application.log
  pattern:
    file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
    console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"

# 生产环境缓存配置
app:
  cache:
    product-ttl: 3600  # 1小时
    category-ttl: 7200 # 2小时