application-prod.yml 1.99 KB
# 生产环境配置
spring:
  # 数据源配置
  datasource:
    url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:apple_erp}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=true&allowPublicKeyRetrieval=false
    username: ${DB_USERNAME:apple_erp}
    password: ${DB_PASSWORD:MySQL@123}
    druid:
      # 生产环境使用更多连接数
      initial-size: 10
      min-idle: 10
      max-active: 50
      max-wait: 60000
      # 生产环境关闭监控页面
      stat-view-servlet:
        enabled: false

  # Redis配置
  redis:
    host: ${REDIS_HOST:localhost}
    port: ${REDIS_PORT:6379}
    password: ${REDIS_PASSWORD:}
    database: ${REDIS_DATABASE:0}

  # 生产环境开启缓存
  cache:
    type: redis
    redis:
      time-to-live: 3600000

# MyBatis Plus配置
mybatis-plus:
  configuration:
    # 生产环境不打印SQL
    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl

# 日志配置
logging:
  level:
    com.apple.erp: info
    org.springframework.security: warn
    org.springframework.web: warn
    com.alibaba.druid: warn
  file:
    name: /app/logs/apple-erp.log
  logback:
    rollingpolicy:
      max-file-size: 100MB
      max-history: 30
      total-size-cap: 1GB

# 自定义配置
apple:
  erp:
    # JWT配置
    jwt:
      secret: ${JWT_SECRET:apple-erp-jwt-secret-key-prod-2024}
      expiration: ${JWT_EXPIRATION:86400}
      refresh-expiration: ${JWT_REFRESH_EXPIRATION:604800}
    
    # 文件上传配置
    upload:
      path: ${UPLOAD_PATH:/app/upload/}
      allowed-types: jpg,jpeg,png,gif,pdf,doc,docx,xls,xlsx
      max-size: 10
    
    # 短信配置
    sms:
      aliyun:
        access-key-id: ${SMS_ACCESS_KEY_ID:}
        access-key-secret: ${SMS_ACCESS_KEY_SECRET:}
        sign-name: ${SMS_SIGN_NAME:}
        template-code: ${SMS_TEMPLATE_CODE:}

# 监控配置
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics
  endpoint:
    health:
      show-details: when-authorized