File tree Expand file tree Collapse file tree 5 files changed +6
-29
lines changed Expand file tree Collapse file tree 5 files changed +6
-29
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,3 @@ APS_REDIS_PASSWORD=''
1717APS_REDIS_DATABASE = 1
1818# Token
1919TOKEN_SECRET_KEY = ' 1VkVF75nsNABBjK_7-qz7GtzNy3AMvktc9TCPwKczCk'
20- # Email
21- EMAIL_USER = ' xxxx-nav@qq.com'
22- EMAIL_PASSWORD = ' '
Original file line number Diff line number Diff line change 55script_location = alembic
66
77# template used to generate migration files
8- # file_template = %%(rev)s_%%(slug)s
8+ file_template = %%(year)d-%%(month).2d-%%(day).2d_%%(hour).2d-%%(minute).2d_ %%(rev)s_%%(slug)s
99
1010# sys.path path, will be prepended to sys.path if present.
1111# defaults to the current working directory.
Original file line number Diff line number Diff line change 88from loguru import logger
99
1010from backend .app .core import path_conf
11+ from backend .app .core .conf import settings
1112
1213
1314class Logger :
@@ -17,7 +18,7 @@ def log() -> loguru.Logger:
1718 os .mkdir (path_conf .LogPath )
1819
1920 # 日志文件
20- log_file = os .path .join (path_conf .LogPath , 'FastBlog.log' )
21+ log_file = os .path .join (path_conf .LogPath , settings . LOG_FILE_NAME )
2122
2223 # loguru日志
2324 # more: https://github.com/Delgan/loguru#ready-to-use-out-of-the-box-without-boilerplate
Original file line number Diff line number Diff line change @@ -31,10 +31,6 @@ class Settings(BaseSettings):
3131 # Env Token
3232 TOKEN_SECRET_KEY : str # 密钥 secrets.token_urlsafe(32))
3333
34- # Env Email
35- EMAIL_USER : str
36- EMAIL_PASSWORD : str # 授权密码,非邮箱密码
37-
3834 # FastAPI
3935 TITLE : str = 'FastAPI'
4036 VERSION : str = '0.0.1'
@@ -78,14 +74,8 @@ def validator_api_url(cls, values):
7874 TOKEN_EXPIRE_MINUTES : int = 60 * 24 * 1 # token 时效 60 * 24 * 1 = 1 天
7975 TOKEN_URL : str = '/v1/users/login'
8076
81- # Email
82- EMAIL_DESCRIPTION : str = 'fastapi_sqlalchemy_mysql' # 默认发件说明
83- EMAIL_SERVER : str = 'smtp.qq.com'
84- EMAIL_PORT : int = 465
85- EMAIL_SSL : bool = True
86-
87- # Cookies
88- COOKIES_MAX_AGE : int = 60 * 5 # cookies 时效 60 * 5 = 5 分钟
77+ # Log
78+ LOG_FILE_NAME : str = 'fba.log'
8979
9080 # Middleware
9181 MIDDLEWARE_CORS : bool = True
@@ -94,7 +84,7 @@ def validator_api_url(cls, values):
9484
9585 class Config :
9686 # https://docs.pydantic.dev/usage/settings/#dotenv-env-support
97- env_file = '.env' , '.env.example'
87+ env_file = '.env'
9888 env_file_encoding = 'utf-8'
9989
10090
Original file line number Diff line number Diff line change @@ -51,17 +51,6 @@ class Settings(BaseSettings):
5151 TOKEN_SECRET_KEY : str = '1VkVF75nsNABBjK_7-qz7GtzNy3AMvktc9TCPwKczCk' # 密钥 secrets.token_urlsafe(32))
5252 TOKEN_EXPIRE_MINUTES : int = 60 * 24 * 1 # token 时效 60 * 24 * 1 = 1 天
5353
54- # Email
55- EMAIL_DESCRIPTION : str = 'fastapi_sqlalchemy_mysql' # 默认发件说明
56- EMAIL_SERVER : str = 'smtp.qq.com'
57- EMAIL_PORT : int = 465
58- EMAIL_USER : str = 'xxxx-nav@qq.com'
59- EMAIL_PASSWORD : str = '' # 授权密码,非邮箱密码
60- EMAIL_SSL : bool = True # 是否使用ssl
61-
62- # 邮箱登录验证码过期时间
63- EMAIL_LOGIN_CODE_MAX_AGE : int = 60 * 2 # 时效 60 * 2 = 2 分钟
64-
6554 # Cookies
6655 COOKIES_MAX_AGE : int = 60 * 5 # cookies 时效 60 * 5 = 5 分钟
6756
You can’t perform that action at this time.
0 commit comments