application-xxx.yml
chestnut:
# 名称,未授权不能修改
name: 栗子内容管理系统
# 代号,未授权不能修改
alias: ChestnutCMS
# 版本,未授权不能修改
version: 1.5.8
# 版权年份,未授权不能修改
copyrightYear: 2022-2025
# 雪花ID配置
snowflake:
# 机器ID,默认:1
workId: 1
# 分页配置
page:
# 默认分页起始页码,默认:1
startPageNumber: 1
# 默认分页每页数量,默认:20
defaultPageSize: 20
# 分页数上限,默认:10000
maxPageSize: 10000
# 认证配置
security:
# Argon2配置
argon2:
# 时间成本
# 也被称为迭代次数,决定了算法需要执行多少次迭代。增加这个值会增加计算所需的时间,从而提高安全性。
# 你应该选择一个足够高的值,使得计算一个哈希至少需要耗费几百毫秒,但又不会导致用户体验不佳。
iterations: 1
# 内存成本
# 定义了算法在处理过程中使用的内存量(以KiB为单位)。增大这个值可以有效抵抗基于RAM限制的攻击方法。
# 通常建议从30-40 MiB开始,并根据你的服务器资源进行调整。
# 确保选择的值不会导致内存交换(swap),因为这会显著降低性能。
memory: 65536
# 并行度
# 表示可以在计算过程中并行运行的计算单元数量。这个参数允许你利用多核处理器的优势。
# 对于大多数应用场景来说,设置为1到4之间的值是合理的。
parallelism: 2
# 验证码配置
captcha:
# 验证码过期时间,单位:秒,默认:10分钟
expireSeconds: 600
# 字符点击验证码配置
clickWord:
# 文字大小,默认:25
fontSize: 25
# 图片处理配置
image:
# 处理方式,JDK = 基于jdk处理,GraphicsMagick = 基于GraphicsMagick处理
type: 'JDK'
# GraphicsMagick配置
graphics-magick:
# GraphicsMagick命令行路径
path: 'D:/dev/GraphicsMagick/1.3.45-Q8/'
# 忽略水印操作的图片宽度,0标识不忽略,默认:0
# 例如:100,宽度小于100的图片不做水印处理
watermarkIgnoreWidth: 0
# 忽略水印操作的图片高度,默认:0
watermarkIgnoreHeight: 0
# 异步任务线程池配置
async:
pool:
# 线程名前缀,默认:ChestnutTask-
threadNamePrefix: "ChestnutTask-"
# 线程池队列大小,默认:100
queueCapacity: 10000
# 核心线程数量,默认:8
# 核心线程会常驻,即使没有任务需要执行
# 当allowCoreThreadTimeout=true时,核心线程会超时关闭
coreSize: 8
# 线程池最大线程数量,默认:20
# 队列满后会创建新线程执行队列任务,线程数最大不超过此配置
maxSize: 20
# 是否允许核心线程超时关闭
allowCoreThreadTimeout: true
# 线程空闲时间,空闲超过配置时间会关闭线程,默认:60s
keepAlive: "60s"
# 发布线程池停机策略配置
shutdown:
# 是否等待线程池未完成任务执行完成,默认:true
awaitTermination: true
# 等待未完成任务执行完成超时时间,默认:120s
awaitTerminationPeriod: "120s"
# FreeMarker配置
freemarker:
# 模板默认根目录,默认取当前项目部署路径同级目录statics作为模板目录
templateLoaderPath: '/home/app/statics'
# 模板文件编码,默认:UTF-8
defaultEncoding: "UTF-8"
# MRU缓存配置
# 缓存分两级,强引用->弱引用,强引用数达到上限则会将使用次数更少的转移到弱引用缓存,强引用不会被JVM释放,弱引用则相反
mruCache:
# 强引用
strongSizeLimit: 50
# 弱引用
softSizeLimit: 200
# KV配置
settings: {k1: v1, k2: v2}
# 系统模块配置
system:
# 演示模式开关
demoMode: false
# 系统模块文件上传目录 示例( Windows配置D:/chestnut/uploadPath,Linux配置 /home/chestnut/uploadPath)
uploadPath: 'E:/dev/workspace_chestnut/uploadPath'
# 会员模块配置
member:
# 会员资源文件上传目录,例如:会员头像
uploadPath: 'E:/dev/workspace_chestnut/_xy_member/'
# 内容管理模块配置
cms:
# 资源文件根目录,默认:应用同级wwwroot_release目录
resourceRoot: /home/app/wwwroot_release
# 缓存Key前缀,默认:cms:
cacheName: cms:
# 系统启动时是否清空cacheName前缀的所有缓存,默认:false
resetCache: false
# 资源分片文件过期时间,默认:24小时,单位:秒
resourceChunkExpireSeconds: 3600
# 发布配置
publish:
# 发布策略
# - ThreadPool = 本地线程池实现
# - RedisStream = Redis消息队列实现
# - RedisSet = 定时读redis-set发布任务实现
strategy: ThreadPool
# 启动时清理发布消息队列,默认:true
# 仅在使用RedisStream或RedisSet策略时有效
clearOnStart: false
# 发布消息消费者数量,默认:2
consumerCount: 2
# 发布线程池配置,参考chestnut.async异步任务线程池配置
pool:
threadNamePrefix: "CMS-PUBLISH-"
queueCapacity: 10000
shutdown:
awaitTermination: true
awaitTerminationPeriod: "120s"
# 开发环境配置
server:
# 服务器的HTTP端口,默认为9080
port: 9080
# 开启优雅停机
shutdown: graceful
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数,默认为100
accept-count: 1000
threads:
# tomcat最大线程数,默认为200
max: 800
# Tomcat启动初始化的线程数,默认值10
min-spare: 100
# 日志配置
logging:
config: classpath:logback-dev.xml
level:
org.springframework: warn
com.chestnut: debug
cron: debug
publish: debug
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
lifecycle:
# 设置停机缓冲时间,默认:30s
timeout-per-shutdown-phase: 20s
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 200MB
# 设置总上传的文件大小
max-request-size: 200MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: false
freemarker:
check-template-location: false
elasticsearch:
uris: http://127.0.0.1:9200
username: elastic
password: hello1234
# redis 配置
data:
redis:
# 地址
host: 127.0.0.1
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password: b18a03
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
flyway:
enabled: false
# 迁移sql脚本文件存放路径,默认:classpath:db/migration
locations: classpath:db/migration/mysql
# 迁移sql脚本文件名称的前缀,默认:V
sql-migration-prefix: V
# 迁移sql脚本文件名称分隔符,默认2个下划线:__
sql-migration-separator: __
# 迁移sql脚本文件名称后缀
sql-migration-suffixes: .sql
# 迁移时是否进行校验
validate-on-migrate: true
# 当迁移发现数据库非空且存在没有元数据的表时,自动执行基准迁移,新建schema_version表
baseline-on-migrate: true
# 数据库配置
datasource:
type: com.zaxxer.hikari.HikariDataSource
dynamic:
primary: master
# 严格模式 匹配不到数据源则报错
strict: true
# 主库
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
# 从库
#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:
# 连接池名
pool-name: HikariCP
# 连接超时时间:毫秒, 默认30秒
connection-timeout: 2000
# 最小空闲连接,默认值10,小于0或大于maximum-pool-size,都会重置为maximum-pool-size
minimum-idle: 5
# 最大连接数,小于等于0会被重置为默认值10;大于零小于1会被重置为minimum-idle的值
maximum-pool-size: 20
# 空闲连接最大存活时间,默认值600000(10分钟),大于等于max-lifetime且max-lifetime>0,会被重置为0;不等于0且小于10秒,会被重置为10秒。
idle-timeout: 200000
# 连接池返回的连接默认自动提交,默认只 true
auto-commit: true
# 连接最大存活时间,不等于0且小于30秒,会被重置为默认值30分钟.设置应该比mysql设置的超时时间短
max-lifetime: 1800000
# 用于测试连接是否可用的查询语句
connection-test-query: SELECT 1
# 链接占用超时时间,超时会打印警告信息,可能存在连接泄露风险。单位:毫秒,默认:0。
leak-detection-threshold: 60000
# 邮件配置
mail:
host: smtp.163.com
port: 465
username: xxx@163.com
# 授权码
password: xxx
# 编码格式
default-encoding: utf-8
# 协议
protocol: smtps
properties:
mail:
smtp:
ssl:
enable: true
auth: true
starttls:
enable: true
required: true
# 监控配置
application:
name: "ChestnutCMS"
boot:
admin:
client:
# 增加客户端开关
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
# 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名称 (同时也是cookie名称)
token-name: Authorization
# token前缀
token-prefix: Bearer
cookie-auto-fill-prefix: true
# token有效期,单位s 默认30天, -1代表永不过期
timeout: 2592000
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
active-timeout: -1
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: true
# token风格
token-style: uuid
# 是否输出操作日志
is-log: true
# MyBatis配置
mybatis-plus:
global-config:
enable-sql-runner: true
# 搜索指定包别名
typeAliasesPackage: com.chestnut.**.domain
# 配置mapper的扫描,找到所有的mapper.xml映射文件
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)"
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 处理方式,CLEAN = 删除,ESCAPE = html转义
mode: CLEAN
xxl:
job:
enable: false
accessToken: default_token
adminAddresses: http://127.0.0.1:18080/xxl-job-admin
executor:
### 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
appname: chestnut-admin
### 执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
#address:
### 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
ip:
### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
port: 9968
### 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
logpath: E:/dev/workspace_chestnut/ChestnutCMS/chestnut-modules/chestnut-xxljob/jobhandler
### 执行器日志文件保存天数 [选填] : 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能;默认:30
logretentiondays: 30