diff --git a/app/core/config.py b/app/core/config.py index 41a3e8e8..cd4820dc 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -429,7 +429,8 @@ class Settings(BaseSettings, ConfigModel, LogConfigModel): else: value_to_write = str(converted_value) if converted_value is not None else "" - set_key(SystemUtils.get_env_path(), field.name, value_to_write) + set_key(dotenv_path=SystemUtils.get_env_path(), key_to_set=field.name, value_to_set=value_to_write, + quote_mode="always") if is_converted: logger.info(f"配置项 '{field.name}' 已自动修正并写入到 'app.env' 文件") return True, message