From 599817eec7f017ecac8e12b2be1e7a229caf5bc4 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 7 Oct 2023 04:44:06 -0700 Subject: [PATCH] test --- app/core/config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/core/config.py b/app/core/config.py index 886fb718..57cad63f 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -1,9 +1,16 @@ +import os import secrets from pathlib import Path from typing import List +from dotenv import load_dotenv from pydantic import BaseSettings +load_dotenv( + dotenv_path=Path(os.environ.get("CONFIG_DIR", "/config")) / "app.env", + encoding="utf-8" +) + class Settings(BaseSettings): # 项目名称 @@ -285,6 +292,6 @@ class Settings(BaseSettings): settings = Settings( - _env_file="/config/app.env", + _env_file=Path(os.environ.get("CONFIG_DIR", "/config")) / "app.env", _env_file_encoding="utf-8" )