fix: populate app configs to system environment variables (#5590)

This commit is contained in:
Bowen Liang 2024-06-26 14:27:49 +08:00 committed by GitHub
parent b8926ea267
commit d0fe56a98e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,6 +82,16 @@ def create_flask_app_with_configs() -> Flask:
""" """
dify_app = DifyApp(__name__) dify_app = DifyApp(__name__)
dify_app.config.from_mapping(DifyConfig().model_dump()) 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 return dify_app