refactor(admin): 重构应用配置文件

- 移除 application.yml 中的 excelTemplate 配置项
- 将 active 配置从 druid 改为 prod- 重命名 application-druid.yml 为 application-dev.yml
- 新增 application-prod.yml 生产环境配置文件
master
chenhao 2025-05-21 09:16:41 +08:00
parent 53cbc19d15
commit b8c94a67a0
3 changed files with 129 additions and 62 deletions

View File

@ -1,61 +1,63 @@
# 数据源配置 ruoyi:
spring: excelTemplate: D:\ruoyi\excelTemplate
datasource: # 数据源配置
type: com.alibaba.druid.pool.DruidDataSource spring:
driverClassName: com.mysql.cj.jdbc.Driver datasource:
druid: type: com.alibaba.druid.pool.DruidDataSource
# 主库数据源 driverClassName: com.mysql.cj.jdbc.Driver
master: druid:
url: jdbc:mysql://121.199.168.157:3306/unis_pms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true # 主库数据源
username: root master:
password: unis@db url: jdbc:mysql://121.199.168.157:3306/unis_pms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true
# 从库数据源 username: root
slave: password: unis@db
# 从数据源开关/默认关闭 # 从库数据源
enabled: false slave:
url: # 从数据源开关/默认关闭
username: enabled: false
password: url:
# 初始连接数 username:
initialSize: 5 password:
# 最小连接池数量 # 初始连接数
minIdle: 10 initialSize: 5
# 最大连接池数量 # 最小连接池数量
maxActive: 20 minIdle: 10
# 配置获取连接等待超时的时间 # 最大连接池数量
maxWait: 60000 maxActive: 20
# 配置连接超时时间 # 配置获取连接等待超时的时间
connectTimeout: 30000 maxWait: 60000
# 配置网络超时时间 # 配置连接超时时间
socketTimeout: 60000 connectTimeout: 30000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 # 配置网络超时时间
timeBetweenEvictionRunsMillis: 60000 socketTimeout: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
minEvictableIdleTimeMillis: 300000 timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最大生存的时间,单位是毫秒 # 配置一个连接在池中最小生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000 minEvictableIdleTimeMillis: 300000
# 配置检测连接是否有效 # 配置一个连接在池中最大生存的时间,单位是毫秒
validationQuery: SELECT 1 FROM DUAL maxEvictableIdleTimeMillis: 900000
testWhileIdle: true # 配置检测连接是否有效
testOnBorrow: false validationQuery: SELECT 1 FROM DUAL
testOnReturn: false testWhileIdle: true
webStatFilter: testOnBorrow: false
enabled: true testOnReturn: false
statViewServlet: webStatFilter:
enabled: true enabled: true
# 设置白名单,不填则允许所有访问 statViewServlet:
allow: enabled: true
url-pattern: /druid/* # 设置白名单,不填则允许所有访问
# 控制台管理用户名和密码 allow:
login-username: ruoyi url-pattern: /druid/*
login-password: 123456 # 控制台管理用户名和密码
filter: login-username: ruoyi
stat: login-password: 123456
enabled: true filter:
# 慢SQL记录 stat:
log-slow-sql: true enabled: true
slow-sql-millis: 1000 # 慢SQL记录
merge-sql: true log-slow-sql: true
wall: slow-sql-millis: 1000
config: merge-sql: true
wall:
config:
multi-statement-allow: true multi-statement-allow: true

View File

@ -0,0 +1,66 @@
ruoyi:
excelTemplate: /home/application/excelTemplate
server:
# 服务器的HTTP端口默认为80
port: 28081
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://121.199.168.157:3306/unis_sip_pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true
username: root
password: unis@db
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -12,7 +12,6 @@ ruoyi:
profile: D:\ruoyi\uploadPath profile: D:\ruoyi\uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
excelTemplate: D:\ruoyi\excelTemplate
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为80 # 服务器的HTTP端口默认为80
@ -59,7 +58,7 @@ spring:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
profiles: profiles:
active: druid active: dev
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart: