From dc62599565031955c2ebcda5e5cb7f521d935620 Mon Sep 17 00:00:00 2001 From: FahadKhalid210 Date: Thu, 18 Apr 2024 17:14:33 +0500 Subject: [PATCH] update cors and readme --- README.rst | 7 +++++++ .../cairn/apps/superset/superset_config.py | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index dd5e82d..e99b74a 100644 --- a/README.rst +++ b/README.rst @@ -240,6 +240,13 @@ Postgresql/Superset settings - ``CAIRN_POSTGRESQL_PASSWORD`` (default: ``"{{ 20|random_string }}"``): Postgresql password. - ``CAIRN_SUPERSET_SECRET_KEY`` (default: ``"{{ 20|random_string }}"``): randomly-generated secret key for the Superset frontend. +Add/Update Superset Configurations +---------------------------------- + +Use ``cairn-superset-settings`` patch to add or update `Superset configurations `__. +Then apply changes with:: + tutor local launch + Troubleshooting --------------- diff --git a/tutorcairn/templates/cairn/apps/superset/superset_config.py b/tutorcairn/templates/cairn/apps/superset/superset_config.py index 7de555f..a1fe4e9 100644 --- a/tutorcairn/templates/cairn/apps/superset/superset_config.py +++ b/tutorcairn/templates/cairn/apps/superset/superset_config.py @@ -163,12 +163,17 @@ class CeleryConfig: # pylint: disable=too-few-public-methods } # Embedded Dashboard CORS +OPENEDX_CMS_ROOT_URL = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ CMS_HOST }}" + +if os.environ.get("FLASK_ENV") == "development": + OPENEDX_CMS_ROOT_URL = "http://{{ CMS_HOST }}:8001" + ENABLE_CORS=True CORS_OPTIONS={ - "supports_credentials": True, - "allow_headers": ["*"], - "resources": ["*"], - 'origins': ["{{ LMS_HOST }}","{{ CMS_HOST }}"], + "origins": [ + f"{OPENEDX_LMS_ROOT_URL}", + f"{OPENEDX_CMS_ROOT_URL}" + ], } {{ patch("cairn-superset-settings") }}