refactor: extract cors configs into dify config and cleanup the config class (#5507)

Co-authored-by: takatost <takatost@gmail.com>
This commit is contained in:
Bowen Liang
2024-06-25 15:48:02 +08:00
committed by GitHub
parent ec1d3ddee2
commit 2a0f03a511
8 changed files with 51 additions and 55 deletions

View File

@@ -24,7 +24,6 @@ from flask_cors import CORS
from werkzeug.exceptions import Unauthorized
from commands import register_commands
from config import Config
# DO NOT REMOVE BELOW
from events import event_handlers
@@ -82,7 +81,6 @@ def create_flask_app_with_configs() -> Flask:
with configs loaded from .env file
"""
dify_app = DifyApp(__name__)
dify_app.config.from_object(Config())
dify_app.config.from_mapping(DifyConfig().model_dump())
return dify_app
@@ -232,7 +230,7 @@ def register_blueprints(app):
app = create_app()
celery = app.extensions["celery"]
if app.config['TESTING']:
if app.config.get('TESTING'):
print("App is running in TESTING mode")