spring:
  application:
    name: data-server

  profiles:
    active: @profiles.active@

  cloud:
    nacos:
      server-addr: @nacos.server@ # Nacos 服务器地址
      username: @nacos.username@
      password: @nacos.password@
      discovery: # 【配置中心】配置项
        ip: @deploy.server@
        namespace: ${spring.profiles.active}
        group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
        metadata:
          version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布
      config: # 【注册中心】配置项
        namespace: ${spring.profiles.active}
        group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP

  main:
    allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
    allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务

  config:
    import:
      - optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
      - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置

  # Servlet 配置
  servlet:
    # 文件上传相关配置项
    multipart:
      max-file-size: 16MB # 单个文件大小
      max-request-size: 32MB # 设置总上传的文件大小
  mvc:
    pathmatch:
      matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类

  # Jackson 配置项
  jackson:
    serialization:
      write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
      write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
      write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
      fail-on-empty-beans: false # 允许序列化无属性的 Bean

  # Cache 配置项
  cache:
    type: REDIS
    redis:
      time-to-live: 1h # 设置过期时间为 1 小时

server:
  port: 8982
  servlet:
    session:
      timeout: 120s

logging:
  file:
    name: @log.path@/log/${spring.application.name}.log # 日志文件名,全路径
  level:
    org:
      springframework:
        boot:
          autoconfigure:
            logging: info

--- #################### 接口文档配置 ####################

springdoc:
  api-docs:
    enabled: true # 1. 是否开启 Swagger 接文档的元数据
    path: /v3/api-docs
  swagger-ui:
    enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
    path: /swagger-ui.html
  default-flat-param-object: true

knife4j:
  enable: true
  basic:
    enable: false
    username: admin
    password: admin
  setting:
    enableFooter: false

# MyBatis Plus 的配置项
mybatis-plus:
  configuration:
    map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
  global-config:
    db-config:
      id-type: AUTO # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
      #      id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库
      #      id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库
      #      id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
      logic-delete-value: 1 # 逻辑已删除值(默认为 1)
      logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
    banner: false # 关闭控制台的 Banner 打印
  type-aliases-package: ${iailab.info.base-package}.*.entity
  mapper-locations: classpath*:/mapper/**/*.xml
  encryptor:
    password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成

mybatis-plus-join:
  banner: false # 关闭控制台的 Banner 打印

# Spring Data Redis 配置
spring:
  data:
    redis:
      repositories:
        enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度

# VO 转换(数据翻译)相关
easy-trans:
  is-enable-global: true # 启用全局翻译(拦截所有 SpringMVC ResponseBody 进行自动翻译 )。如果对于性能要求很高可关闭此配置,或通过 @IgnoreTrans 忽略某个接口
  is-enable-cloud: false # 禁用 TransType.RPC 微服务模式


--- #################### 平台相关配置 ####################

iailab:
  info:
    version: 1.0.0
    base-package: com.iailab.module.data
  web:
    admin-ui:
      url:  # Admin 管理后台 UI 的地址
  swagger:
    title: 数据采集
    description: 数据采集
    version: ${iailab.info.version}
    base-package: ${iailab.info.base-package}
  tenant: # 多租户相关配置项
    enable: true
    ignore-tables:
      - qrtz_blob_triggers
      - qrtz_calendars
      - qrtz_cron_triggers
      - qrtz_fired_triggers
      - qrtz_job_details
      - qrtz_locks
      - qrtz_paused_trigger_grps
      - qrtz_scheduler_state
      - qrtz_simple_triggers
      - qrtz_simprop_triggers
      - qrtz_triggers
      - schedule_job
      - schedule_job_log
      - t_channel_kio_device
      - t_channel_kio_tag
      - t_channel_modbus_device
      - t_channel_modbus_tag
      - t_channel_opcda_device
      - t_channel_opcda_tag
      - t_channel_opcua_device
      - t_channel_opcua_tag
      - t_da_math_point
      - t_da_measure_point
      - t_da_point
      - t_da_point_value
      - t_da_sequence_num
      - t_http_api
      - t_http_tag
      - t_http_token
      - t_ind_data_set
      - t_ind_data_set_field
      - t_ind_item_category
      - t_ind_item
      - t_ind_item_atom
      - t_ind_item_der
      - t_ind_item_cal
      - t_ind_item_value
      - t_video_nvr
      - t_video_log
      - t_video_camera
      - t_video_image
      - t_plan_data_set
      - t_plan_item_category
      - t_plan_item
      - t_da_cumulate_point
      - t_da_point_collect_status
      - t_arc_data
      - t_arc_setting
  app:
    app-key: data
    app-secret: 85b0df7edc3df3611913df34ed695011
    core-host: 127.0.0.1


debug: true