Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor: Create a `dify_config` with Pydantic. (#5938)
-LAN-cb8feb732fd3
diff --git a/api/app.py b/api/app.pyindex 2c9b59706b4..e0cccd61839 100644--- a/api/app.py+++ b/api/app.py@@ -1,6 +1,6 @@import os-from configs.app_config import DifyConfig+from configs import dify_configif not os.environ.get("DEBUG") or os.environ.get("DEBUG", "false").lower() != 'true':from gevent import monkey@@ -81,7 +81,7 @@ def create_flask_app_with_configs() -> Flask:with configs loaded from .env file"""dify_app = DifyApp(__name__)- dify_app.config.from_mapping(DifyConfig().model_dump())+ dify_app.config.from_mapping(dify_config.model_dump())# populate configs into system environment variablesfor key, value in dify_app.config.items():diff --git a/api/commands.py b/api/commands.pyindex 56217c898e2..cc49824b4f5 100644--- a/api/commands.py+++ b/api/commands.py@@ -8,6 +8,7 @@ import clickfrom flask import current_appfrom werkzeug.exceptions import NotFound+from configs import dify_configfrom constants.languages import languagesfrom core.rag.datasource.vdb.vector_factory import Vectorfrom core.rag.datasource.vdb.vector_type import VectorType@@ -112,7 +113,7 @@ def reset_encrypt_key_pair():After the reset, all LLM credentials will become invalid, requiring re-entry.Only support SELF_HOSTED mode."""- if current_app.config['EDITION'] != 'SELF_HOSTED':+ if dify_config.EDITION != 'SELF_HOSTED':click.echo(click.style('Sorry, only support SELF_HOSTED mode.', fg='red'))returndiff --git a/api/configs/__init__.py b/api/configs/__init__.pyindex e69de29bb2d..47dcedcb851 100644--- a/api/configs/__init__.py+++ b/api/configs/__init__.py@@ -0,0 +1,4 @@++from .app_config import DifyConfig++dify_config = DifyConfig()\ No newline at end of file