fix(configs): Update pydantic settings in config files (#6023)

This commit is contained in:
-LAN-
2024-07-07 12:18:15 +08:00
committed by GitHub
parent a877d4831d
commit c436454cd4
30 changed files with 115 additions and 93 deletions

View File

@@ -21,6 +21,7 @@ def example_env_file(tmp_path, monkeypatch) -> str:
def test_dify_config_undefined_entry(example_env_file):
# NOTE: See https://github.com/microsoft/pylance-release/issues/6099 for more details about this type error.
# load dotenv file with pydantic-settings
config = DifyConfig(_env_file=example_env_file)
@@ -43,6 +44,8 @@ def test_dify_config(example_env_file):
assert config.SENTRY_TRACES_SAMPLE_RATE == 1.0
# NOTE: If there is a `.env` file in your Workspace, this test might not succeed as expected.
# This is due to `pymilvus` loading all the variables from the `.env` file into `os.environ`.
def test_flask_configs(example_env_file):
flask_app = Flask('app')
flask_app.config.from_mapping(DifyConfig(_env_file=example_env_file).model_dump())