1+ import argparse
12import os
23import sys
3- import argparse
4- from pydantic_settings import BaseSettings
5- from functools import lru_cache
64from dotenv import load_dotenv
5+ from functools import lru_cache
6+ from pydantic_settings import BaseSettings
77
88
99class AppSettings (BaseSettings ):
1010 """
1111 应用配置
1212 """
13+
1314 app_env : str = 'dev'
1415 app_name : str = 'RuoYi-FasAPI'
1516 app_root_path : str = '/dev-api'
@@ -25,6 +26,7 @@ class JwtSettings(BaseSettings):
2526 """
2627 Jwt配置
2728 """
29+
2830 jwt_secret_key : str = 'b01c66dc2c58dc6a0aabfe2144256be36226de378bf87f72c0c795dda67f4d55'
2931 jwt_algorithm : str = 'HS256'
3032 jwt_expire_minutes : int = 1440
@@ -35,6 +37,7 @@ class DataBaseSettings(BaseSettings):
3537 """
3638 数据库配置
3739 """
40+
3841 db_host : str = '127.0.0.1'
3942 db_port : int = 3306
4043 db_username : str = 'root'
@@ -51,6 +54,7 @@ class RedisSettings(BaseSettings):
5154 """
5255 Redis配置
5356 """
57+
5458 redis_host : str = '127.0.0.1'
5559 redis_port : int = 6379
5660 redis_username : str = ''
@@ -62,20 +66,38 @@ class UploadSettings:
6266 """
6367 上传配置
6468 """
69+
6570 UPLOAD_PREFIX = '/profile'
6671 UPLOAD_PATH = 'vf_admin/upload_path'
6772 UPLOAD_MACHINE = 'A'
6873 DEFAULT_ALLOWED_EXTENSION = [
6974 # 图片
70- "bmp" , "gif" , "jpg" , "jpeg" , "png" ,
75+ 'bmp' ,
76+ 'gif' ,
77+ 'jpg' ,
78+ 'jpeg' ,
79+ 'png' ,
7180 # word excel powerpoint
72- "doc" , "docx" , "xls" , "xlsx" , "ppt" , "pptx" , "html" , "htm" , "txt" ,
81+ 'doc' ,
82+ 'docx' ,
83+ 'xls' ,
84+ 'xlsx' ,
85+ 'ppt' ,
86+ 'pptx' ,
87+ 'html' ,
88+ 'htm' ,
89+ 'txt' ,
7390 # 压缩文件
74- "rar" , "zip" , "gz" , "bz2" ,
91+ 'rar' ,
92+ 'zip' ,
93+ 'gz' ,
94+ 'bz2' ,
7595 # 视频格式
76- "mp4" , "avi" , "rmvb" ,
96+ 'mp4' ,
97+ 'avi' ,
98+ 'rmvb' ,
7799 # pdf
78- " pdf"
100+ ' pdf' ,
79101 ]
80102 DOWNLOAD_PATH = 'vf_admin/download_path'
81103
@@ -90,23 +112,11 @@ class CachePathConfig:
90112 """
91113 缓存目录配置
92114 """
115+
93116 PATH = os .path .join (os .path .abspath (os .getcwd ()), 'caches' )
94117 PATHSTR = 'caches'
95118
96119
97- class RedisInitKeyConfig :
98- """
99- 系统内置Redis键名
100- """
101- ACCESS_TOKEN = {'key' : 'access_token' , 'remark' : '登录令牌信息' }
102- SYS_DICT = {'key' : 'sys_dict' , 'remark' : '数据字典' }
103- SYS_CONFIG = {'key' : 'sys_config' , 'remark' : '配置信息' }
104- CAPTCHA_CODES = {'key' : 'captcha_codes' , 'remark' : '图片验证码' }
105- ACCOUNT_LOCK = {'key' : 'account_lock' , 'remark' : '用户锁定' }
106- PASSWORD_ERROR_COUNT = {'key' : 'password_error_count' , 'remark' : '密码错误次数' }
107- SMS_CODE = {'key' : 'sms_code' , 'remark' : '短信验证码' }
108-
109-
110120class GetConfig :
111121 """
112122 获取配置
0 commit comments