From d0fe56a98e6b9d0cf4852aec572ed09cea7d9ce6 Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Wed, 26 Jun 2024 14:27:49 +0800 Subject: [PATCH] fix: populate app configs to system environment variables (#5590) --- api/app.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/app.py b/api/app.py index 0ee80e5d1..2c9b59706 100644 --- a/api/app.py +++ b/api/app.py @@ -82,6 +82,16 @@ def create_flask_app_with_configs() -> Flask: """ dify_app = DifyApp(__name__) dify_app.config.from_mapping(DifyConfig().model_dump()) + + # populate configs into system environment variables + for key, value in dify_app.config.items(): + if isinstance(value, str): + os.environ[key] = value + elif isinstance(value, int | float | bool): + os.environ[key] = str(value) + elif value is None: + os.environ[key] = '' + return dify_app