@@ -4,64 +4,11 @@ title: 配置
44
55配置文件位于 ` backend/core/conf.py ` ,fba 内的所有应用和插件配置都应统一放置在此文件内
66
7- ## 环境变量配置
7+ ## 环境配置
88
9- ### ` ENVIRONMENT ` <Badge type =" info " text =" Literal['dev', 'pro'] " />
9+ ### ` ENVIRONMENT ` <Badge type =" info " text =" Literal['dev', 'pro'] " /> < Badge type = " warning " text = " env " />
1010
11- 指定环境模式,仅允许 ` dev ` 和 ` pro ` 。当设置为 ` pro ` 时,openapi 相关在线文档将被禁止访问
12-
13- ### ` DATABASE_TYPE ` <Badge type =" info " text =" Literal['mysql', 'postgresql'] " />
14-
15- 指定数据库类型,仅支持 ` mysql ` 和 ` postgresql ` ,需注意第三方插件兼容性
16-
17- ### ` DATABASE_HOST ` <Badge type =" info " text =" str " />
18-
19- 提供数据库的主机地址
20-
21- ### ` DATABASE_PORT ` <Badge type =" info " text =" int " />
22-
23- 提供数据库的主机端口号
24-
25- ### ` DATABASE_USER ` <Badge type =" info " text =" str " />
26-
27- 连接数据库所使用的用户名
28-
29- ### ` DATABASE_PASSWORD ` <Badge type =" info " text =" str " />
30-
31- 连接数据库所使用的密码
32-
33- ### ` REDIS_HOST ` <Badge type =" info " text =" int " />
34-
35- 连接 Redis 数据库的主机地址
36-
37- ### ` REDIS_PORT ` <Badge type =" info " text =" str " />
38-
39- 连接 Redis 数据库的主机端口号
40-
41- ### ` REDIS_PASSWORD ` <Badge type =" info " text =" int " />
42-
43- 连接 Redis 数据库的密码
44-
45- ### ` REDIS_DATABASE ` <Badge type =" info " text =" str " />
46-
47- 全局默认使用的 Redis 逻辑数据库(0 - 15)
48-
49- ### ` TOKEN_SECRET_KEY ` <Badge type =" info " text =" str " />
50-
51- token 生成和解析密钥,用于防止 token 被恶意篡改,密钥生成:` secrets.token_urlsafe(32) `
52-
53- ::: danger
54- 请妥善保管此值,以免遭受恶意攻击
55- :::
56-
57- ### ` OPERA_LOG_ENCRYPT_SECRET_KEY ` <Badge type =" info " text =" " />
58-
59- 操作日志加密密钥,当使用对称加密算法加密操作日志时,将十分重要,密钥生成:
60- ` os.urandom(32).hex() `
61-
62- ::: danger
63- 请妥善保管此值,以免遭受恶意攻击
64- :::
11+ 指定环境模式,当设置为 ` pro ` 时,openapi 相关在线文档将被禁止访问
6512
6613## FastAPI 配置
6714
@@ -97,7 +44,27 @@ openapi JSON 数据在线地址
9744
9845是否开启 FastAPI 静态文件服务
9946
100- ## 数据库基础配置
47+ ## 数据库配置
48+
49+ ### ` DATABASE_TYPE ` <Badge type =" info " text =" Literal['mysql', 'postgresql'] " /> <Badge type =" warning " text =" env " />
50+
51+ 指定数据库类型,仅支持 ` mysql ` 和 ` postgresql ` ,需注意第三方插件兼容性
52+
53+ ### ` DATABASE_HOST ` <Badge type =" info " text =" str " /> <Badge type =" warning " text =" env " />
54+
55+ 提供数据库的主机地址
56+
57+ ### ` DATABASE_PORT ` <Badge type =" info " text =" int " /> <Badge type =" warning " text =" env " />
58+
59+ 提供数据库的主机端口号
60+
61+ ### ` DATABASE_USER ` <Badge type =" info " text =" str " /> <Badge type =" warning " text =" env " />
62+
63+ 连接数据库所使用的用户名
64+
65+ ### ` DATABASE_PASSWORD ` <Badge type =" info " text =" str " /> <Badge type =" warning " text =" env " />
66+
67+ 连接数据库所使用的密码
10168
10269### ` DATABASE_ECHO ` <Badge type =" info " text =" bool | Literal['debug'] " />
10370
@@ -115,25 +82,49 @@ openapi JSON 数据在线地址
11582
11683数据库字符集,仅用于 mysql
11784
118- ## Redis 基础配置
85+ ## Redis 配置
11986
120- ### ` REDIS_TIMEOUT ` <Badge type =" info " text =" int " />
87+ ### ` REDIS_TIMEOUT ` <Badge type =" info " text =" int " /> < Badge type = " warning " text = " env " />
12188
12289连接 Redis 数据库超时时长
12390
124- ## Token 基础配置
91+ ### ` REDIS_HOST ` <Badge type =" info " text =" int " />
92+
93+ 连接 Redis 数据库的主机地址
94+
95+ ### ` REDIS_PORT ` <Badge type =" info " text =" str " />
96+
97+ 连接 Redis 数据库的主机端口号
98+
99+ ### ` REDIS_PASSWORD ` <Badge type =" info " text =" int " />
100+
101+ 连接 Redis 数据库的密码
102+
103+ ### ` REDIS_DATABASE ` <Badge type =" info " text =" str " />
104+
105+ 全局默认使用的 Redis 逻辑数据库(0 - 15)
106+
107+ ## Token 配置
108+
109+ ### ` TOKEN_SECRET_KEY ` <Badge type =" info " text =" str " /> <Badge type =" warning " text =" env " />
110+
111+ token 生成和解析密钥,用于防止 token 被恶意篡改,密钥生成:` secrets.token_urlsafe(32) `
112+
113+ ::: danger
114+ 请妥善保管此值,以免遭受恶意攻击
115+ :::
125116
126117### ` TOKEN_ALGORITHM ` <Badge type =" info " text =" str " />
127118
128119token 加密算法
129120
130121### ` TOKEN_EXPIRE_SECONDS ` <Badge type =" info " text =" int " />
131122
132- token 过期秒数
123+ token 过期时长
133124
134125### ` TOKEN_REFRESH_EXPIRE_SECONDS ` <Badge type =" info " text =" int " />
135126
136- 刷新 token 过期秒数
127+ 刷新 token 过期时长
137128
138129### ` TOKEN_REDIS_PREFIX ` <Badge type =" info " text =" str " />
139130
@@ -190,7 +181,17 @@ JWT 中间件存储用户信息到 Redis 时的前缀
190181
191182### ` COOKIE_REFRESH_TOKEN_EXPIRE_SECONDS ` <Badge type =" info " text =" int " />
192183
193- 将刷新 token 存储到 cookie 时的过期时间
184+ 将刷新 token 存储到 cookie 时的过期时长
185+
186+ ## 验证码配置
187+
188+ ### ` CAPTCHA_LOGIN_REDIS_PREFIX ` <Badge type =" info " text =" str " />
189+
190+ 验证码登录时,验证码存储到 Redis 时的前缀
191+
192+ ### ` CAPTCHA_LOGIN_EXPIRE_SECONDS ` <Badge type =" info " text =" int " />
193+
194+ 验证码登录时,验证码过期时长
194195
195196## 数据权限配置
196197
@@ -342,6 +343,15 @@ JWT 中间件存储用户信息到 Redis 时的前缀
342343
343344## 操作日志
344345
346+ ### ` OPERA_LOG_ENCRYPT_SECRET_KEY ` <Badge type =" info " text =" str " /> <Badge type =" warning " text =" env " />
347+
348+ 操作日志加密密钥,当使用对称加密算法加密操作日志时,将十分重要,密钥生成:
349+ ` os.urandom(32).hex() `
350+
351+ ::: danger
352+ 请妥善保管此值,以免遭受恶意攻击
353+ :::
354+
345355### ` OPERA_LOG_PATH_EXCLUDE ` <Badge type =" info " text =" list[str] " />
346356
347357操作日志路径排除,在此配置内的请求地址不会记录操作日志
@@ -382,84 +392,94 @@ JWT 中间件存储用户信息到 Redis 时的前缀
382392
383393插件信息存储到 Redis 时的前缀
384394
385- ## 验证码配置
386-
387- ### ` CAPTCHA_LOGIN_REDIS_PREFIX ` <Badge type =" info " text =" str " />
388-
389- 验证码登录时,验证码存储到 Redis 时的前缀
390-
391- ### ` CAPTCHA_LOGIN_EXPIRE_SECONDS ` <Badge type =" info " text =" int " />
392-
393- 验证码登录时,验证码过期时间
394-
395395## 应用:Task
396396
397- ### 环境变量配置
398-
399- #### ` CELERY_BROKER_REDIS_DATABASE ` <Badge type =" info " text =" int " />
397+ ### ` CELERY_BROKER_REDIS_DATABASE ` <Badge type =" info " text =" int " /> <Badge type =" warning " text =" env " />
400398
401399Celery 代理使用的 Redis 逻辑数据库
402400
403- #### ` CELERY_RABBITMQ_HOST ` <Badge type =" info " text =" str " />
401+ ### ` CELERY_RABBITMQ_HOST ` <Badge type =" info " text =" str " /> < Badge type = " warning " text = " env " />
404402
405403Celery 连接 RabbitMQ 服务的主机地址
406404
407- #### ` CELERY_RABBITMQ_PORT ` <Badge type =" info " text =" int " />
405+ ### ` CELERY_RABBITMQ_PORT ` <Badge type =" info " text =" int " /> < Badge type = " warning " text = " env " />
408406
409407Celery 连接 RabbitMQ 服务的主机端口号
410408
411- #### ` CELERY_RABBITMQ_USERNAME ` <Badge type =" info " text =" str " />
409+ ### ` CELERY_RABBITMQ_USERNAME ` <Badge type =" info " text =" str " /> < Badge type = " warning " text = " env " />
412410
413411Celery 连接 RabbitMQ 服务的用户名
414412
415- #### ` CELERY_RABBITMQ_PASSWORD ` <Badge type =" info " text =" str " />
413+ ### ` CELERY_RABBITMQ_PASSWORD ` <Badge type =" info " text =" str " /> < Badge type = " warning " text = " env " />
416414
417415Celery 连接 RabbitMQ 服务的密码
418416
419- ### 基础配置
420-
421- #### ` CELERY_BROKER ` <Badge type =" info " text =" Literal['rabbitmq', 'redis'] " />
417+ ### ` CELERY_BROKER ` <Badge type =" info " text =" Literal['rabbitmq', 'redis'] " />
422418
423419Celery 代理模式(开发模式默认使用 Redis,线上模式强制切换为 Rabbitmq)
424420
425- #### ` CELERY_REDIS_PREFIX ` <Badge type =" info " text =" str " />
421+ ### ` CELERY_REDIS_PREFIX ` <Badge type =" info " text =" str " />
426422
427423Celery 数据存储到 Redis 时的前缀
428424
429- #### ` CELERY_TASK_MAX_RETRIES ` <Badge type =" info " text =" int " />
425+ ### ` CELERY_TASK_MAX_RETRIES ` <Badge type =" info " text =" int " />
430426
431427Celery 任务执行失败时的最大重试次数
432428
433- ## 插件:OAuth2
429+ ## 插件:Code Generator
434430
435- ### 环境变量配置
431+ #### ` CODE_GENERATOR_DOWNLOAD_ZIP_FILENAME ` <Badge type =" info " text =" str " />
432+
433+ 下载代码时的 ZIP 压缩包文件名
436434
437- #### ` OAUTH2_GITHUB_CLIENT_ID ` <Badge type =" info " text =" str " />
435+ ## 插件:OAuth2
436+
437+ ### ` OAUTH2_GITHUB_CLIENT_ID ` <Badge type =" info " text =" str " /> <Badge type =" warning " text =" env " />
438438
439439GitHub 客户端 ID
440440
441- #### ` OAUTH2_GITHUB_CLIENT_SECRET ` <Badge type =" info " text =" str " />
441+ ### ` OAUTH2_GITHUB_CLIENT_SECRET ` <Badge type =" info " text =" str " /> < Badge type = " warning " text = " env " />
442442
443443GitHub 客户端密钥
444444
445- #### ` OAUTH2_LINUX_DO_CLIENT_ID ` <Badge type =" info " text =" str " />
445+ ### ` OAUTH2_LINUX_DO_CLIENT_ID ` <Badge type =" info " text =" str " /> < Badge type = " warning " text = " env " />
446446
447447Linux Do 客户端 ID
448448
449- #### ` OAUTH2_LINUX_DO_CLIENT_SECRET ` <Badge type =" info " text =" str " />
449+ ### ` OAUTH2_LINUX_DO_CLIENT_SECRET ` <Badge type =" info " text =" str " /> < Badge type = " warning " text = " env " />
450450
451451Linux Do 客户端密钥
452452
453- ### 基础配置
454-
455- #### ` OAUTH2_FRONTEND_REDIRECT_URI ` <Badge type =" info " text =" str " />
453+ ### ` OAUTH2_FRONTEND_REDIRECT_URI ` <Badge type =" info " text =" str " />
456454
457455登陆成功后,重定向到前端的地址
458456
459- ## 插件:Code Generator
457+ ## 插件:Email
460458
461- ### 基础配置
459+ ### ` EMAIL_USERNAME ` < Badge type = " info " text = " str " />
462460
463- #### ` CODE_GENERATOR_DOWNLOAD_ZIP_FILENAME ` < Badge type = " info " text = " str " />
461+ 电子邮箱发件用户
464462
465- 下载代码时的 ZIP 压缩包文件名
463+ ### ` EMAIL_PASSWORD ` <Badge type =" info " text =" str " />
464+
465+ 电子邮箱发件用户密码
466+
467+ ### ` EMAIL_HOST ` <Badge type =" info " text =" str " />
468+
469+ 电子邮箱服务主机地址
470+
471+ ### ` EMAIL_PORT ` <Badge type =" info " text =" int " />
472+
473+ 电子邮箱服务主机端口号
474+
475+ ### ` EMAIL_SSL ` <Badge type =" info " text =" bool " />
476+
477+ 发送电子邮件时,是否开启 SSL
478+
479+ ### ` EMAIL_CAPTCHA_REDIS_PREFIX ` <Badge type =" info " text =" str " />
480+
481+ 电子邮件验证码存储到 Redis 时的前缀
482+
483+ ### ` EMAIL_CAPTCHA_EXPIRE_SECONDS ` <Badge type =" info " text =" int " />
484+
485+ 电子邮件验证码缓存时长
0 commit comments