mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-12-02 19:27:48 +08:00
fix: populate app configs to system environment variables (#5590)
This commit is contained in:
parent
b8926ea267
commit
d0fe56a98e
10
api/app.py
10
api/app.py
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user