fix: Load the DATA_DIR via derived_settings tooling.
If we don't make the DATA_DIR a derived_setting, the only way to override it is to override the entirety of the MODULESTORE config, or override DATA_DIR in common.py in your fork.
This commit is contained in:
@@ -1614,7 +1614,7 @@ MODULESTORE = {
|
||||
'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
|
||||
'OPTIONS': {
|
||||
'default_class': 'xmodule.hidden_block.HiddenBlock',
|
||||
'fs_root': DATA_DIR,
|
||||
'fs_root': lambda settings: settings.DATA_DIR,
|
||||
'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string',
|
||||
}
|
||||
},
|
||||
@@ -1624,7 +1624,7 @@ MODULESTORE = {
|
||||
'DOC_STORE_CONFIG': DOC_STORE_CONFIG,
|
||||
'OPTIONS': {
|
||||
'default_class': 'xmodule.hidden_block.HiddenBlock',
|
||||
'fs_root': DATA_DIR,
|
||||
'fs_root': lambda settings: settings.DATA_DIR,
|
||||
'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string',
|
||||
}
|
||||
}
|
||||
@@ -1633,6 +1633,7 @@ MODULESTORE = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DATABASES = {
|
||||
# edxapp's edxapp-migrate scripts and the edxapp_migrate play
|
||||
# will ensure that any DB not named read_replica will be migrated
|
||||
|
||||
@@ -26,6 +26,10 @@ REST_FRAMEWORK: {}
|
||||
# off-machine storage to more easily scale the system.
|
||||
MEDIA_ROOT: "/tmp/edx-platform/media/"
|
||||
|
||||
# DATA_DIR is overridden twice in ./lms/envs/common.py override it here temporarily until that's cleaned up and we
|
||||
# can default to something dev friendly and have overrides in production.py for production friendly settings.
|
||||
DATA_DIR: "/tmp/edx-platform/data_dir"
|
||||
|
||||
# For just the CMS
|
||||
LMS_ROOT_URL: "http://localhost"
|
||||
LMS_INTERNAL_ROOT_URL: "http://localhost"
|
||||
|
||||
@@ -490,6 +490,18 @@ XQUEUE_INTERFACE = AUTH_TOKENS.get('XQUEUE_INTERFACE', XQUEUE_INTERFACE)
|
||||
# Get the MODULESTORE from auth.json, but if it doesn't exist,
|
||||
# use the one from common.py
|
||||
MODULESTORE = convert_module_store_setting_if_needed(AUTH_TOKENS.get('MODULESTORE', MODULESTORE))
|
||||
|
||||
# After conversion above, the modulestore will have a "stores" list with all defined stores, for all stores, add the
|
||||
# fs_root entry to derived collection so that if it's a callable it can be resolved. We need to do this because the
|
||||
# `derived_collection_entry` takes an exact index value but the config file might have overidden the number of stores
|
||||
# and so we can't be sure that the 2 we define in common.py will be there when we try to derive settings. This could
|
||||
# lead to execptions being thrown when the `derive_settings` call later in this file tries to update settings. We call
|
||||
# the derived_collection_entry function here to ensure that we update the fs_root for any callables that remain after
|
||||
# we've updated the MODULESTORE setting from our config file.
|
||||
for idx, store in enumerate(MODULESTORE['default']['OPTIONS']['stores']):
|
||||
if 'OPTIONS' in store and 'fs_root' in store["OPTIONS"]:
|
||||
derived_collection_entry('MODULESTORE', 'default', 'OPTIONS', 'stores', idx, 'OPTIONS', 'fs_root')
|
||||
|
||||
MONGODB_LOG = AUTH_TOKENS.get('MONGODB_LOG', {})
|
||||
|
||||
EMAIL_HOST_USER = AUTH_TOKENS.get('EMAIL_HOST_USER', '') # django default is ''
|
||||
|
||||
Reference in New Issue
Block a user