server:
  port: ${AIIMAGE_SERVER_PORT:18080}

spring:
  application:
    name: aiimage-backend
  config:
    import: optional:classpath:application-local.yml
  servlet:
    multipart:
      max-file-size: 200MB
      max-request-size: 500MB
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: ${AIIMAGE_DB_URL:jdbc:mysql://127.0.0.1:3306/aiimage?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false}
    username: ${AIIMAGE_DB_USERNAME:root}
    password: ${AIIMAGE_DB_PASSWORD:change-me}
    hikari:
      maximum-pool-size: ${AIIMAGE_DB_POOL_MAX_SIZE:30}
      minimum-idle: ${AIIMAGE_DB_POOL_MIN_IDLE:5}
      connection-timeout: ${AIIMAGE_DB_POOL_CONNECTION_TIMEOUT_MS:30000}
      leak-detection-threshold: ${AIIMAGE_DB_POOL_LEAK_DETECT_MS:0}
  data:
    redis:
      host: ${AIIMAGE_REDIS_HOST:127.0.0.1}
      port: ${AIIMAGE_REDIS_PORT:6379}
      password: ${AIIMAGE_REDIS_PASSWORD:}
      database: ${AIIMAGE_REDIS_DATABASE:0}
      timeout: ${AIIMAGE_REDIS_TIMEOUT:5s}

management:
  health:
    db:
      enabled: false

logging:
  file:
    path: ${AIIMAGE_LOG_PATH:./logs}
    name: ${AIIMAGE_LOG_FILE:aiimage-backend.log}
  level:
    root: INFO
    com.nanri.aiimage: INFO
  pattern:
    file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
    console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"

mybatis-plus:
  mapper-locations: classpath*:mapper/**/*.xml
  configuration:
    map-underscore-to-camel-case: true
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

springdoc:
  api-docs:
    enabled: true

knife4j:
  enable: true
  setting:
    language: zh_cn

aiimage:
  oss:
    region: ${AIIMAGE_OSS_REGION:cn-hangzhou}
    endpoint: ${AIIMAGE_OSS_ENDPOINT:oss-cn-hangzhou.aliyuncs.com}
    bucket: ${AIIMAGE_OSS_BUCKET:change-me}
    access-key-id: ${AIIMAGE_OSS_ACCESS_KEY_ID:change-me}
    access-key-secret: ${AIIMAGE_OSS_ACCESS_KEY_SECRET:change-me}
  storage:
    local-temp-dir: ${AIIMAGE_STORAGE_LOCAL_TEMP_DIR:./data/tmp}
    cleanup-enabled: ${AIIMAGE_STORAGE_CLEANUP_ENABLED:true}
    cleanup-cron: ${AIIMAGE_STORAGE_CLEANUP_CRON:0 0 */6 * * *}
    source-retention-hours: ${AIIMAGE_STORAGE_SOURCE_RETENTION_HOURS:48}
    result-retention-hours: ${AIIMAGE_STORAGE_RESULT_RETENTION_HOURS:24}
  brand-progress:
    ttl-hours: ${AIIMAGE_BRAND_PROGRESS_TTL_HOURS:24}
    failed-ttl-hours: ${AIIMAGE_BRAND_PROGRESS_FAILED_TTL_HOURS:2}
    heartbeat-timeout-minutes: ${AIIMAGE_BRAND_PROGRESS_HEARTBEAT_TIMEOUT_MINUTES:15}
    stale-check-cron: ${AIIMAGE_BRAND_PROGRESS_STALE_CHECK_CRON:0 */2 * * * *}
  delete-brand-progress:
    heartbeat-timeout-minutes: ${AIIMAGE_DELETE_BRAND_HEARTBEAT_TIMEOUT_MINUTES:15}
    stale-check-cron: ${AIIMAGE_DELETE_BRAND_STALE_CHECK_CRON:0 */2 * * * *}
    finalize-check-cron: ${AIIMAGE_DELETE_BRAND_FINALIZE_CHECK_CRON:30 */2 * * * *}
    product-risk-stale-timeout-hours: ${AIIMAGE_PRODUCT_RISK_STALE_TIMEOUT_HOURS:48}
  module-cleanup:
    enabled: ${AIIMAGE_MODULE_CLEANUP_ENABLED:true}
    cron: ${AIIMAGE_MODULE_CLEANUP_CRON:0 0 0 * * *}
    module-types: ${AIIMAGE_MODULE_CLEANUP_MODULE_TYPES:DEDUPE,SPLIT,CONVERT,DELETE_BRAND,PRODUCT_RISK_RESOLVE}
  ziniao:
    enabled: ${AIIMAGE_ZINIAO_ENABLED:false}
    base-url: ${AIIMAGE_ZINIAO_BASE_URL:https://sbappstoreapi.ziniao.com/openapi-router}
    api-key: ${AIIMAGE_ZINIAO_API_KEY:}
    app-id: ${AIIMAGE_ZINIAO_APP_ID:change-me}
    app-secret: ${AIIMAGE_ZINIAO_APP_SECRET:change-me}
    company-id: ${AIIMAGE_ZINIAO_COMPANY_ID:0}
    app-token-path: ${AIIMAGE_ZINIAO_APP_TOKEN_PATH:/auth/get_app_token}
    staff-list-path: ${AIIMAGE_ZINIAO_STAFF_LIST_PATH:/superbrowser/rest/v1/erp/staff/list}
    user-stores-path: ${AIIMAGE_ZINIAO_USER_STORES_PATH:/superbrowser/rest/v1/erp/user/stores}
    user-login-token-path: ${AIIMAGE_ZINIAO_USER_LOGIN_TOKEN_PATH:/superbrowser/rest/v1/token/user-login}
    open-store-scheme: ${AIIMAGE_ZINIAO_OPEN_STORE_SCHEME:superbrowser://OpenStrore}
    open-store-user-id: ${AIIMAGE_ZINIAO_OPEN_STORE_USER_ID:}
    open-store-launch-url: ${AIIMAGE_ZINIAO_OPEN_STORE_LAUNCH_URL:https://www.baidu.com}
    open-store-auto-open: ${AIIMAGE_ZINIAO_OPEN_STORE_AUTO_OPEN:true}
    open-store-debug-port: ${AIIMAGE_ZINIAO_OPEN_STORE_DEBUG_PORT:60001}
    open-store-not-prompt-for-download: ${AIIMAGE_ZINIAO_OPEN_STORE_NOT_PROMPT_FOR_DOWNLOAD:true}
    open-store-force-download-path: ${AIIMAGE_ZINIAO_OPEN_STORE_FORCE_DOWNLOAD_PATH:}
    open-store-extra-args: ${AIIMAGE_ZINIAO_OPEN_STORE_EXTRA_ARGS:--disable-gpu start-maximized}
    session-ttl-hours: ${AIIMAGE_ZINIAO_SESSION_TTL_HOURS:2}
    shops-cache-minutes: ${AIIMAGE_ZINIAO_SHOPS_CACHE_MINUTES:30}
    connect-timeout-seconds: ${AIIMAGE_ZINIAO_CONNECT_TIMEOUT_SECONDS:5}
    read-timeout-seconds: ${AIIMAGE_ZINIAO_READ_TIMEOUT_SECONDS:15}
    key-scan-max-keys: ${AIIMAGE_ZINIAO_KEY_SCAN_MAX_KEYS:100}
    key-scan-max-seconds: ${AIIMAGE_ZINIAO_KEY_SCAN_MAX_SECONDS:30}
    shop-index-refresh-cron: ${AIIMAGE_ZINIAO_SHOP_INDEX_REFRESH_CRON:0 */10 * * * *}
    shop-index-fresh-minutes: ${AIIMAGE_ZINIAO_SHOP_INDEX_FRESH_MINUTES:20}
    shop-index-entry-ttl-hours: ${AIIMAGE_ZINIAO_SHOP_INDEX_ENTRY_TTL_HOURS:12}
    shop-index-refresh-batch-size: ${AIIMAGE_ZINIAO_SHOP_INDEX_REFRESH_BATCH_SIZE:100}
