From f49269efd91c390a286d8b3fdb8200abc2c57a59 Mon Sep 17 00:00:00 2001 From: Jhony Avella Date: Wed, 1 Jun 2022 11:06:43 -0500 Subject: [PATCH] feat: adding settings to enable SCORM storage backend --- cms/envs/production.py | 16 ++++++++++++++++ lms/envs/production.py | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/cms/envs/production.py b/cms/envs/production.py index ef5353a9fb41..4a4a42fa2012 100644 --- a/cms/envs/production.py +++ b/cms/envs/production.py @@ -592,3 +592,19 @@ def get_env_setting(setting): 'cms.djangoapps.contentstore.tasks.update_search_index': { 'queue': UPDATE_SEARCH_INDEX_JOB_QUEUE}, } + +from storages.backends.s3boto import S3BotoStorage +def scorm_xblock_storage(xblock): + from django.conf import settings + return S3BotoStorage( + bucket=settings.AWS_STORAGE_BUCKET_NAME, + access_key=settings.AWS_ACCESS_KEY_ID, + secret_key=settings.AWS_SECRET_ACCESS_KEY, + host="s3.eu-west-1.amazonaws.com", + querystring_expire=86400, + custom_domain= settings.CMS_BASE + '/scorm-xblock' + ) + +XBLOCK_SETTINGS["ScormXBlock"] = { + "STORAGE_FUNC": scorm_xblock_storage, +} diff --git a/lms/envs/production.py b/lms/envs/production.py index d9f6515da425..2332c0650800 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -1049,3 +1049,19 @@ def get_env_setting(setting): 'openedx.core.djangoapps.coursegraph.dump_course_to_neo4j': { 'queue': COURSEGRAPH_JOB_QUEUE}, } + +from storages.backends.s3boto import S3BotoStorage +def scorm_xblock_storage(xblock): + from django.conf import settings + return S3BotoStorage( + bucket=settings.AWS_STORAGE_BUCKET_NAME, + access_key=settings.AWS_ACCESS_KEY_ID, + secret_key=settings.AWS_SECRET_ACCESS_KEY, + host="s3.eu-west-1.amazonaws.com", + querystring_expire=86400, + custom_domain= settings.LMS_BASE + '/scorm-xblock' + ) + +XBLOCK_SETTINGS["ScormXBlock"] = { + "STORAGE_FUNC": scorm_xblock_storage, +}