From 349406334ffb60841ce83cd9ffe7b6d06c446fae Mon Sep 17 00:00:00 2001 From: Neng Wan Date: Thu, 5 Feb 2026 18:44:12 +0800 Subject: [PATCH] feat(config): restore loading config from environment --- CHANGELOG.md | 4 ++++ sea/__init__.py | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e19de64..ff04e94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## [4.0.1] - 2026-02-05 +### Added +- 在应用初始化时自动从环境变量加载配置,环境变量会覆盖配置文件中的同名配置项 + ## [4.0.0] - 2025-08-28 ### Changed - Update protobuf requirement diff --git a/sea/__init__.py b/sea/__init__.py index e57cdc6..71d479d 100644 --- a/sea/__init__.py +++ b/sea/__init__.py @@ -28,6 +28,7 @@ def create_app(root_path=None): app_class = import_string("app:App") _app = app_class(root_path, env=env) _app.config.from_object(config) + _app.config.load_config_from_env() _app.load_middlewares() _app.load_extensions_in_module(import_string("app.extensions"))