Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding settings to enable SCORM storage backend #265

Open
wants to merge 1 commit into
base: open-release/koa.nelp
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
16 changes: 16 additions & 0 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DonatoB-eduNEXT I'm wondering if we would require an extra layer of validation here. I know the storage likely won't change in the future but what if the platform no longer supports S3BotoStorage because of a configuration change? We could validate if the setting DEFAULT_FILE_STORAGE in Django matches any of the storages supported by SCORM, and then you can return the proper storage object. It's not a must-have, but it would strengthen the implementation. It would apply for both files, LMS and CMS

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,
}