Configuration instructions

application-xxx.yml

chestnut:
  # Name. It cannot be modified without authorization.
  name: ChestnutCMS
  # Code name. Cannot be modified without authorization.
  alias: ChestnutCMS
  # Version. It cannot be modified without authorization.
  version: 1.5.8
  # Copyright year, unauthorized modification is not allowed
  copyrightYear: 2022-2025
  # Snowflake ID configuration
  snowflake:
    # Machine ID, default: 1
    workId: 1
  # Pagination configuration
  page:
    # Default page number for pagination, default: 1
    startPageNumber: 1
    # Default page size: 20
    defaultPageSize: 20
    # Maximum number of pages per file. Default value: 10000
    maxPageSize: 10000
  # Authentication configuration
  security:
    # Argon2 configuration
    argon2:
      # Time cost
      # Also known as the number of iterations, it determines how many times the algorithm needs to perform iterations. Increasing this value will increase the time required for computation, thereby enhancing security.
      # You should choose a value that is high enough, so that calculating the hash takes at least a few hundred milliseconds. At the same time, this value should not negatively impact the user experience.
      iterations: 1
      # Memory cost
      # It specifies the amount of memory required by the algorithm during processing, measured in KiB. Increasing this value can effectively counter attacks based on RAM limitations.
      # It is generally recommended to start with a size of 30-40 MiB, and adjust the size based on the resources available on your server.
      # Make sure that the values you choose do not result in the use of swap space, as this will significantly reduce performance.
      memory: 65536
      # Parallelism
      # The number of computational units that can run in parallel during the calculation process. This parameter allows you to take advantage of the capabilities of multi-core processors.
      # For most use cases, setting the value to between 1 and 4 is appropriate.
      parallelism: 2
  # Configure verification code settings
  captcha:
    # Verification code expiration time, unit: seconds, default: 10 minutes
    expireSeconds: 600
    # Configuration of character verification codes
    clickWord:
      # Text size. Default value: 25
      fontSize: 25
  # Image processing configuration
  image:
    # Processing methods: JDK – processed based on JDK; GraphicsMagick – processed based on GraphicsMagick.
    type: 'JDK'
    # Configuring GraphicsMagick
    graphics-magick:
      # GraphicsMagick command line path
      path: 'D:/dev/GraphicsMagick/1.3.45-Q8/'
      # Width of the image when watermark operations are ignored. 0 indicates not to ignore them. Default value: 0.
      # For example: If the width of the image is less than 100, it will not be processed as a watermark.
      watermarkIgnoreWidth: 0
      # Ignore the height of images with watermarks. Default value: 0
      watermarkIgnoreHeight: 0
  # Configure the asynchronous task thread pool
  async:
    pool:
      # Thread name prefix, default: ChestnutTask-
      threadNamePrefix: "ChestnutTask-"
      # The size of the thread pool queue, default: 100
      queueCapacity: 10000
      # Number of core threads, default: 8
      # The core threads will remain active, even when no tasks need to be executed.
      # When allowCoreThreadTimeout=true, the core threads will be shut down after a timeout.
      coreSize: 8
      # The maximum number of threads in the thread pool is 20 by default.
      # When the queue is full, a new thread will be created to execute the tasks in the queue. The maximum number of threads that can be used does not exceed this configuration limit.
      maxSize: 20
      # Whether core threads can be closed after a timeout occurs
      allowCoreThreadTimeout: true
      # Thread idle time: Threads will be closed if they are idle for more than the configured time. Default value: 60 seconds
      keepAlive: "60s"
    # Configuration for the release thread pool shutdown strategy
    shutdown:
      # Whether to wait for the thread pool to complete the unfinished tasks. Default value: true
      awaitTermination: true
      # Wait for the unfinished tasks to complete within the timeout period. Default value: 120 seconds
      awaitTerminationPeriod: "120s"
  # FreeMarker configuration      
  freemarker:
    # The default template directory is the same as the deployment path of the current project. The `statics` directory at the same level is used as the template directory.
    templateLoaderPath: '/home/app/statics'
    # Template file encoding. Default value: UTF-8
    defaultEncoding: "UTF-8"
    # MRU Cache Configuration
    # The cache is divided into two levels: strong references and weak references. When the number of strong references reaches the maximum limit, those references with fewer usage counts will be moved to the weak reference cache. Strong references will not be released by the JVM, while weak references are the opposite.
    mruCache:
      # Strong Reference
      strongSizeLimit: 50
      # Weak Reference
      softSizeLimit: 200
    # KV configuration  
    settings: {k1: v1, k2: v2}
  # System module configuration
  system:
    # Demo Mode Switch
    demoMode: false
    # Directory for uploading system module files. Example: In Windows, set it to D:/chestnut/uploadPath; in Linux, set it to /home/chestnut/uploadPath.
    uploadPath: 'E:/dev/workspace_chestnut/uploadPath'
  # Member Module Configuration
  member:
    # Member resource file upload directory, for example: Member avatar
    uploadPath: 'E:/dev/workspace_chestnut/_xy_member/'
  # Configuration of the content management module
  cms:
    # Resource file root directory. Default value: wwwroot_release directory, same level as the application.
    resourceRoot: /home/app/wwwroot_release
    # Cache key prefix. Default value: cms:.
    cacheName: cms:
    # When the system starts up, should all caches with the “CacheName” prefix be cleared? Default value: false
    resetCache: false
    # The expiration time for resource shard files is 24 hours by default, measured in seconds.
    resourceChunkExpireSeconds: 3600
    # Publish Configuration
    publish:
      # Release Strategy
      # - ThreadPool = Implementation using local thread pool
      # - RedisStream = Implementation using Redis Message Queue
      # - RedisSet = Implemented through scheduled reading of redis-set tasks
      strategy: ThreadPool
      # Clean up the publishing message queue upon startup. Default value: true
      # This option is only applicable when using RedisStream or RedisSet strategies.
      clearOnStart: false
      # Number of message consumers for publishing, default: 2
      consumerCount: 2
      # Configuration of the publishing thread pool, refer to chestnut.async asynchronous task thread pool configuration.
      pool:
        threadNamePrefix: "CMS-PUBLISH-"
        queueCapacity: 10000
      shutdown:
        awaitTermination: true
        awaitTerminationPeriod: "120s"

# Configuration of the development environment
server:
  # The HTTP port of the server is 9080 by default.
  port: 9080
  # Enable graceful shutdown
  shutdown: graceful 
  servlet:
    # Application access path
    context-path: /
  tomcat:
    # Tomcat URI encoding
    uri-encoding: UTF-8
    # The number of queues after the connection limit is reached, default value: 100
    accept-count: 1000
    threads:
      # The maximum number of threads for Tomcat is 200 by default.
      max: 800
      # The number of threads used for initial initialization during Tomcat startup, default value: 10
      min-spare: 100

# Log configuration
logging:
  config: classpath:logback-dev.xml
  level:
    org.springframework: warn
    com.chestnut: debug
    cron: debug
    publish: debug

# Spring Configuration
spring:
  # Resource information
  messages:
    # Internationalization resource file path
    basename: i18n/messages
  lifecycle: 
    # Set a shutdown buffer time, default: 30 seconds
    timeout-per-shutdown-phase: 20s 
  # File Upload
  servlet:
    multipart: 
      # Size of a single file
      max-file-size:  200MB
      # Set the total size of files to be uploaded
      max-request-size:  200MB
  # Service modules
  devtools:
    restart:
      # Hot deployment switch
      enabled: false
  freemarker:
    check-template-location: false
  elasticsearch:
    uris: http://127.0.0.1:9200
    username: elastic
    password: hello1234
  # Redis configuration
  data:
    redis:
      # Address
      host: 127.0.0.1
      # Port, default is 6379
      port: 6379
      # Database index
      database: 0
      # Password
      password: b18a03
      # Connection timeout duration
      timeout: 10s
      lettuce: 
        pool: 
          # The minimum number of idle connections in the connection pool
          min-idle: 0
          # The maximum number of idle connections in the connection pool
          max-idle: 8
          # The maximum number of database connections in the connection pool
          max-active: 8
          # Maximum blocking wait time for the connection pool (negative values indicate no limit)
          max-wait: -1ms
  flyway:
    enabled: false
    # Path for storing the SQL script files. Default value: classpath:db/migration
    locations: classpath:db/migration/mysql
    # Prefix for migrating SQL script files. Default value: V
    sql-migration-prefix: V
    # Separator for naming migration SQL script files, default is two underscores:__
    sql-migration-separator: __
    # The suffix of the SQL script file for migration
    sql-migration-suffixes: .sql
    # Do we perform verification during the migration process?
    validate-on-migrate: true
    # When the migration detects that the database is not empty and there are tables without metadata, the benchmark migration will be automatically executed to create a new schema_version table.
    baseline-on-migrate: true
  # Database configuration
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    dynamic:
      primary: master
      # If the data source cannot be matched in strict mode, an error will be reported.
      strict: true
      # Main Database
      datasource:
        master:
          type: ${spring.datasource.type}
          driverClassName: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://127.0.0.1:3308/chestnut_cms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&&nullCatalogMeansCurrent=true
          username: root
          password: hello1234
#        master:
#          type: ${spring.datasource.type}
#          driverClassName: org.postgresql.Driver
#          url: jdbc:postgresql://127.0.0.1:5432/chestnut_cms2
#          username: postgres
#          password: hello1234
#        master:
#          type: ${spring.datasource.type}
#          driverClassName: dm.jdbc.driver.DmDriver
#          url: jdbc:dm://127.0.0.1:5236/SYSDBA
#          username: SYSDBA
#          password: Hello1234
        # Secondary Database
        #slave:
        #  lazy: true
        #  type: ${spring.datasource.type}
        #  driverClassName: com.mysql.cj.jdbc.Driver
        #  url: jdbc:mysql://127.0.0.1:3308/ry_cms1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
        #  username:
        #  password:
    hikari:
      # Connection pool name
      pool-name: HikariCP
      # Connection timeout period: milliseconds, default is 30 seconds
      connection-timeout: 2000
      # Minimum idle connections. Default value is 10. If the value is less than 0 or greater than maximum-pool-size, it will be reset to maximum-pool-size.
      minimum-idle: 5
      # The maximum number of connections. If this value is less than or equal to 0, it will be reset to the default value of 10. If it is greater than zero but less than 1, it will be reset to the minimum idle value.
      maximum-pool-size: 20
      # Maximum duration for idle connections. Default value: 600,000 seconds (10 minutes). Only values greater than or equal to max-lifetime and with max-lifetime > 0 will be considered valid. Values that are not equal to 0 and less than 10 seconds will be reset to 10 seconds.
      idle-timeout: 200000
      # The connections returned by the connection pool are automatically committed by default. By default, this is set to true.
      auto-commit: true
      # The maximum connection duration, which is not equal to 0 and less than 30 seconds, will be reset to the default value of 30 minutes. The setting should be shorter than the timeout set by MySQL.
      max-lifetime: 1800000
      # Query statements used to test the availability of connections
      connection-test-query: SELECT 1
      # The connection timeout period is exceeded. Warning messages will be displayed during this time, and there is a risk of connection leakage. Unit: milliseconds. Default value: 0.
      leak-detection-threshold: 60000

  # Email configuration
  mail:
    host: smtp.163.com
    port: 465
    username: xxx@163.com
    # Authorization code
    password: xxx
    # Encoding format
    default-encoding: utf-8
    # Protocols
    protocol: smtps
    properties:
      mail:
        smtp:
          ssl:
            enable: true
          auth: true
          starttls:
            enable: true
            required: true
  # Monitoring Configuration
  application:
    name: "ChestnutCMS"
  boot:
    admin:
      client:
        # Add client switches
        enabled: false
        # Admin Server URL
        url: http://127.0.0.1:8090/admin
        instance:
          service-host-type: IP
        username: chestnut
        password: 123456
springdoc:
  api-docs:
    enabled: true
  swagger-ui:
    path: /swagger-ui.html


# Configuration items for monitoring endpoints in Actuator
management:
  endpoints:
    enabled-by-default: false
    web:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: ALWAYS
    logfile:
      external-file: ./logs/client.log
  httpexchanges:
    recording:
      enabled: true

sa-token: 
    # Token name (which is also the name of the cookie)
    token-name: Authorization
    # Token Prefix
    token-prefix: Bearer
    cookie-auto-fill-prefix: true
    # Token validity period, in seconds. Default value is 30 days. -1 indicates that the token has no expiration date. 
    timeout: 2592000
    # Token temporary validity period (The token expires if no action is taken within the specified time). Unit: seconds
    active-timeout: -1
    # Whether concurrent logins are allowed for the same account. If this parameter is set to true, multiple users can log in simultaneously; if it’s set to false, new logins will replace existing logins. 
    is-concurrent: true
    # When multiple people log in with the same account, should a single token be used? If set to true, all users share the same token during login; if set to false, a new token is created for each login attempt. 
    is-share: true
    # Token-style
    token-style: uuid
    # Should the operation log be output? 
    is-log: true            
  
# MyBatis Configuration
mybatis-plus:
  global-config:
    enable-sql-runner: true
  # Search for specified package aliases
  typeAliasesPackage: com.chestnut.**.domain
  # Configure the scanner for the mapper to find all mapper.xml mapping files.
  mapperLocations: classpath*:mapper/**/*Mapper.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

decorator:
  datasource:
    p6spy:
      logging: file
      log-file: logs/spy.log
      log-format: "cost: %(executionTime)ms | sql:%(sqlSingleLine)"

# Prevent XSS attacks
xss: 
  # Filter switch
  enabled: true
  # Processing method: CLEAN = Delete, ESCAPE = HTML encoding
  mode: CLEAN

xxl:
  job:
    enable: false
    accessToken: default_token
    adminAddresses: http://127.0.0.1:18080/xxl-job-admin
    executor:
      ### Executor AppName [optional]: Based on the executor heartbeat registration group; if empty, automatic registration is disabled.
      appname: chestnut-admin
      ### Executor registration [optional]: This configuration is used as the registration address by default. If left empty, the embedded service “IP:PORT” will be used as the registration address. This approach allows for more flexible handling of dynamic IP addresses and port mappings in container-type executors.
      #address: 
      ### Executor IP [optional]: Default to empty indicates automatic IP acquisition. When multiple network cards are used, a specified IP can be manually set. This IP will not be bound to the Host and is only used for communication purposes. The address information is used for "executor registration" and "scheduling center requests to trigger tasks".
      ip: 
      ### Executor port number [optional]: If set to 0 or lower, it will be automatically determined. The default port is 9999. When deploying multiple executors on a single machine, make sure to configure different ports for each executor.
      port: 9968
      ### Executor operation log file storage path [optional]: It is necessary to have read/write privileges for this path. If left empty, the default path will be used.
      logpath: E:/dev/workspace_chestnut/ChestnutCMS/chestnut-modules/chestnut-xxljob/jobhandler
      ### Number of days to keep executor log files [Optional]: Logs will be automatically deleted after the specified number of days. This feature becomes effective when the threshold is 3 or higher. Otherwise, if the value is -1, the automatic deletion function will be disabled. Default value: 30 days.
      logretentiondays: 30

On this page