-
Notifications
You must be signed in to change notification settings - Fork 104
/
application-prod.yml
241 lines (225 loc) · 7.19 KB
/
application-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
--- ### 项目配置
project:
# URL
url: https://cnadmin.charles7c.top
# 是否为生产环境
production: true
--- ### 服务器配置
server:
# HTTP 端口(默认 8080)
port: 18000
--- ### 数据源配置
spring.datasource:
type: com.zaxxer.hikari.HikariDataSource
## 动态数据源配置(可配多主多从:m1、s1...、纯粹多库:mysql、oracle...、混合配置:m1、s1、oracle...)
dynamic:
# 是否启用 P6Spy(SQL 性能分析组件,默认 false,该插件有性能损耗,不建议生产环境使用)
p6spy: false
# 设置默认的数据源或者数据源组(默认 master)
primary: master
# 严格匹配数据源(true 未匹配到指定数据源时抛异常;false 使用默认数据源;默认 false)
strict: false
datasource:
# 主库配置(可配多个,构成多主)
master:
url: jdbc:mysql:https://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
username: ${DB_USER:root}
password: ${DB_PWD:123456}
driver-class-name: com.mysql.cj.jdbc.Driver
# 从库配置(可配多个,构成多从)
slave_1:
url: jdbc:mysql:https://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false
username:
password:
lazy: true
driver-class-name: com.mysql.cj.jdbc.Driver
type: ${spring.datasource.type}
# Hikari 连接池配置(完整配置请参阅:https://github.com/brettwooldridge/HikariCP)
hikari:
# 最大连接数量(默认 10,根据实际环境调整)
# 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒
max-pool-size: 20
# 获取连接超时时间(默认 30000 毫秒,30 秒)
connection-timeout: 30000
# 空闲连接最大存活时间(默认 600000 毫秒,10 分钟)
idle-timeout: 600000
# 保持连接活动的频率,以防止它被数据库或网络基础设施超时。该值必须小于 maxLifetime(默认 0,禁用)
keepaliveTime: 30000
# 连接最大生存时间(默认 1800000 毫秒,30 分钟)
max-lifetime: 1800000
--- ### Liquibase 配置
spring.liquibase:
# 是否启用
enabled: true
# 配置文件路径
change-log: classpath:/db/changelog/db.changelog-master.yaml
--- ### Redis 配置(单机版)
spring.data:
redis:
# 地址
host: ${REDIS_HOST:127.0.0.1}
# 端口(默认 6379)
port: ${REDIS_PORT:6379}
# 密码(未设置密码时可为空或注释掉)
password: ${REDIS_PWD:123456}
# 数据库索引
database: ${REDIS_DB:0}
# 连接超时时间
timeout: 10s
# 是否开启 SSL
ssl:
enabled: false
--- ### Spring Cache 配置
spring.cache:
redis:
# 缓存过期时长(单位:毫秒,默认 -1,表示永不过期)
time-to-live: 7200000
# 是否允许缓存空值(默认 true,表示允许,可以解决缓存穿透问题)
cache-null-values: true
--- ### Just Auth 配置
justauth:
enabled: true
type:
GITEE:
client-id: 5d271b7f638941812aaf8bfc2e2f08f06d6235ef934e0e39537e2364eb8452c4
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${project.url}/social/callback?source=gitee
GITHUB:
client-id: 38080dad08cfbdfacca9
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${project.url}/social/callback?source=github
cache:
type: custom
--- ### 短信配置
sms:
# 从 YAML 读取配置
config-type: yaml
is-print: false
blends:
cloopen:
# 短信厂商
supplier: cloopen
base-url: https://app.cloopen.com:8883/2013-12-26
access-key-id: 你的Access Key
access-key-secret: 你的Access Key Secret
sdk-app-id: 你的应用ID
--- ### 邮件配置
spring.mail:
# 根据需要更换
host: smtp.126.com
port: 465
username: 你的邮箱
password: 你的邮箱授权码
default-encoding: utf-8
properties:
mail:
smtp:
auth: true
socketFactory:
class: javax.net.ssl.SSLSocketFactory
port: 465
--- ### 验证码配置
captcha:
## 图片验证码配置
image:
# 类型
type: SPEC
# 内容长度
length: 4
# 过期时间
expirationInMinutes: 2
# 宽度
width: 111
# 高度
height: 36
## 邮箱验证码配置
mail:
# 内容长度
length: 6
# 过期时间
expirationInMinutes: 5
# 限制时间
limitInSeconds: 60
# 模板路径
templatePath: mail/captcha.ftl
## 短信验证码配置
sms:
# 内容长度
length: 4
# 过期时间
expirationInMinutes: 5
# 限制时间
limitInSeconds: 60
# 模板 ID
templateId: 1
--- ### 安全配置-排除路径配置
security.excludes:
- /error
# 静态资源
- /*.html
- /**/*.html
- /**/*.css
- /**/*.js
- /webSocket/**
# 本地存储资源
- /avatar/**
- /file/**
--- ### 非对称加密配置(例如:密码加密传输,前端公钥加密,后端私钥解密;在线生成 RSA 密钥对:https://web.chacuo.net/netrsakeypair)
rsa:
# 私钥
privateKey: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAznV2Bi0zIX61NC3zSx8U6lJXbtru325pRV4Wt0aJXGxy6LMTsfxIye1ip+f2WnxrkYfk/X8YZ6FWNQPaAX/iRwIDAQABAkEAk/VcAusrpIqA5Ac2P5Tj0VX3cOuXmyouaVcXonr7f+6y2YTjLQuAnkcfKKocQI/juIRQBFQIqqW/m1nmz1wGeQIhAO8XaA/KxzOIgU0l/4lm0A2Wne6RokJ9HLs1YpOzIUmVAiEA3Q9DQrpAlIuiT1yWAGSxA9RxcjUM/1kdVLTkv0avXWsCIE0X8woEjK7lOSwzMG6RpEx9YHdopjViOj1zPVH61KTxAiBmv/dlhqkJ4rV46fIXELZur0pj6WC3N7a4brR8a+CLLQIhAMQyerWl2cPNVtE/8tkziHKbwW3ZUiBXU24wFxedT9iV
--- ### 日志配置
logging:
level:
top.charles7c: INFO
file:
path: ../logs
--- ### 接口文档配置
springdoc:
swagger-ui:
enabled: false
## 接口文档增强配置
knife4j:
# 开启生产环境屏蔽
production: true
--- ### 文件上传配置
spring.servlet:
multipart:
enabled: true
# 单文件上传大小限制
max-file-size: 10MB
# 单次总上传文件大小限制
max-request-size: 20MB
--- ### 本地存储配置
local-storage:
# 文件模式
filePattern: /file/**
# 头像模式
avatarPattern: /avatar/**
# 文件上传大小限制
maxSizeInMb: 10
# 头像上传大小限制
avatarMaxSizeInMb: 5
## Windows 系统本地存储配置
windows:
file: C:\${project.appName}\data\file\
avatar: C:\${project.appName}\data\avatar\
## Linux 系统本地存储配置
linux:
file: ../data/file/
avatar: ../data/avatar/
## Mac 系统本地存储配置
mac:
file: ~/data/file/
avatar: ~/data/avatar/
--- ### 跨域配置
cors:
# 配置允许跨域的域名
allowedOrigins:
- ${project.url}
# 配置允许跨域的请求方式
allowedMethods: '*'
# 配置允许跨域的请求头
allowedHeaders: '*'
# 配置允许跨域的响应头
exposedHeaders: '*'