From b5ac9d4ce46fca931fd815a944132d28d29164ce Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 7 Oct 2023 04:08:19 -0700 Subject: [PATCH] fix app.env --- app/core/config.py | 9 +++++---- config/app.env | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 21c3fe2e5..c46ffee6f 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -27,7 +27,7 @@ class Settings(BaseSettings): # 是否开发模式 DEV: bool = False # 配置文件目录 - CONFIG_DIR: str = None + CONFIG_DIR: str = "/config" # 超级管理员 SUPERUSER: str = "admin" # 超级管理员初始密码 @@ -281,9 +281,10 @@ def __init__(self, **kwargs): p.mkdir(parents=True, exist_ok=True) class Config: - env_file = "/config/app.env" - env_file_encoding = "utf-8" case_sensitive = True -settings = Settings() +settings = Settings( + _env_file=Settings().CONFIG_PATH / "app.env", + _env_file_encoding="utf-8" +) diff --git a/config/app.env b/config/app.env index b0149b696..6cf9e4e42 100644 --- a/config/app.env +++ b/config/app.env @@ -11,8 +11,6 @@ PORT=3001 DEBUG=false # 是否开发模式 DEV=false -# 配置文件目录 -CONFIG_DIR="/config" # 超级管理员 SUPERUSER="admin" # 超级管理员初始密码