server:
  port: 8096
  servlet:
    context-path: /api
    # cookie 30 天过期
    session:
      cookie:
        max-age: 2592000

spring:
  application:
    name: smile-picture-backend
  # 数据库配置
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/smile-picture
    username: root
    password: 123456
  # Redis 配置
  redis:
    database: 1
    host: localhost
    port: 6379
    password: 123456
    timeout: 5000
  # Session 配置
  session:
    store-type: redis
    # session 30 天后过期，单位是秒
    timeout: 2592000
  servlet:
    multipart:
      max-file-size: 10MB
      max-request-size: 10MB
  # 空间图片分表
  shardingsphere:
    datasource:
      names: smile-picture
      smile-picture:
        type: com.zaxxer.hikari.HikariDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/smile-picture
        username: root
        password: 123456
    rules:
      sharding:
        tables:
          picture:
            actual-data-nodes: smile-picture.picture # 动态分表
            table-strategy:
              standard:
                sharding-column: space_id
                sharding-algorithm-name: picture_sharding_algorithm  # 使用自定义分片算法
        sharding-algorithms:
          picture_sharding_algorithm:
            type: CLASS_BASED
            props:
              strategy: standard
              algorithmClassName: edu.whut.smilepicturebackend.manager.sharding.PictureShardingAlgorithm
    props:
      sql-show: true   #打印实际执行的sql

  # 发送邮件配置（QQ邮箱）
  mail:
    host: ${smile-picture.email.host}
    port: ${smile-picture.email.port}
    nickname: Smile图库
    username: ${smile-picture.email.username}
    password: ${smile-picture.email.password}
    protocol: ${smile-picture.email.protocol}
    default-encoding: UTF-8
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true
            required: true
          ssl:
            enable: true
          socketFactory:
            port: ${smile-picture.email.port}
            class: javax.net.ssl.SSLSocketFactory

mybatis-plus:
  type-aliases-package: edu.whut.smilepicturebackend.model.entity
  configuration:
    # MyBatis 配置
    map-underscore-to-camel-case: true     #是否开启驼峰转换
    # 仅在开发环境打印日志
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  global-config:
    enable-sql-runner: true
    db-config:
      logic-delete-field: isDelete # 全局逻辑删除的实体字段名  删除操作时表中数据不会被物理删除，只会设置isDelete为1
      logic-delete-value: 1 # 逻辑已删除值（默认为 1）
      logic-not-delete-value: 0 # 逻辑未删除值（默认为 0）

# 接口文档配置
knife4j:
  enable: true
  openapi:
    title: 接口文档
    version: 1.0
    group:
      default:
        api-rule: package
        api-rule-resources:
          - edu.whut.smilepicturebackend.controller    #接口地址

# 对象存储配置（需要从腾讯云获取）
cos:
  client:
    host: ${smile-picture.cos.client.host}
    secretId: ${smile-picture.cos.client.secretId}
    secretKey: ${smile-picture.cos.client.secretKey}
    region: ${smile-picture.cos.client.region}
    bucket: ${smile-picture.cos.client.bucket}

smile-picture:
  aliyun:
    apiKey: ${smile-picture.aliyun.apiKey}