server:
  port: 8082
  tomcat:
    threads:
      max: 200
      min-spare: 10
    max-connections: 10000
    accept-count: 200

spring:
  application:
    name: file-service
  servlet:
    multipart:
      enabled: true
      max-file-size: 10MB
      max-request-size: 100MB
  
  # 数据库配置
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://${DB_HOST:111.229.80.149}:${DB_PORT:3306}/erp_db?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=false
    username: ${DB_USERNAME:root}
    password: ${DB_PASSWORD:nihao588+}
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      initial-size: 10
      min-idle: 10
      max-active: 50
      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
  
  # Redis配置
  data:
    redis:
      host: ${REDIS_HOST:111.229.80.149}
      port: ${REDIS_PORT:6379}
      password: ${REDIS_PASSWORD:Y(@r5tGk9$Lp2}
      database: 0
      timeout: 5000
      lettuce:
        pool:
          max-active: 20
          max-idle: 10
          min-idle: 5
          max-wait: 3000

# MyBatis Plus配置
mybatis-plus:
  mapper-locations: classpath*:/mapper/**/*.xml
  type-aliases-package: com.erp.file.entity
  global-config:
    db-config:
      id-type: auto
      logic-delete-field: deletedAt
  configuration:
    map-underscore-to-camel-case: true

# 文件存储配置
file:
  storage:
    default: ${FILE_STORAGE_DEFAULT:oss}
    
    # 本地存储配置
    local:
      base-path: ${FILE_STORAGE_LOCAL_PATH:/var/erp/uploads}
      base-url: ${FILE_STORAGE_LOCAL_URL:http://localhost:8082/files}
    
    # 阿里云OSS配置
    oss:
      endpoint: ${OSS_ENDPOINT:}
      access-key-id: ${OSS_ACCESS_KEY_ID:}
      access-key-secret: ${OSS_ACCESS_KEY_SECRET:}
      bucket-name: ${OSS_BUCKET_NAME:}
      base-url: ${OSS_BASE_URL:}
      custom-domain: ${OSS_CUSTOM_DOMAIN:}
    
    # MinIO配置
    minio:
      endpoint: ${MINIO_ENDPOINT:}
      access-key: ${MINIO_ACCESS_KEY:}
      secret-key: ${MINIO_SECRET_KEY:}
      bucket-name: ${MINIO_BUCKET_NAME:erp-files}
      base-url: ${MINIO_BASE_URL:}
      secure: ${MINIO_SECURE:false}
  
  upload:
    max-size: 10485760
    max-files-per-request: 10

# Spring Cloud Nacos配置
spring.cloud:
  nacos:
    discovery:
      server-addr: ${NACOS_SERVER:127.0.0.1:8848}
      namespace: ${NACOS_NAMESPACE:public}
    config:
      server-addr: ${NACOS_SERVER:127.0.0.1:8848}
      namespace: ${NACOS_NAMESPACE:public}
      file-extension: yml

# Actuator配置
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics
  endpoint:
    health:
      show-details: always

# 日志配置
logging:
  level:
    com.erp.file: INFO
    org.springframework.web: WARN
  file:
    name: /app/logs/file-service.log
    max-size: 100MB
    max-history: 30
