diff --git a/cms/envs/production.py b/cms/envs/production.py index 0b5302de7e..98fee62bf8 100644 --- a/cms/envs/production.py +++ b/cms/envs/production.py @@ -8,6 +8,7 @@ This is the default template for our main set of AWS servers. import codecs +import copy import os import yaml @@ -43,6 +44,25 @@ with codecs.open(CONFIG_FILE, encoding='utf-8') as f: ENV_TOKENS = __config__ AUTH_TOKENS = __config__ + # Add the key/values from config into the global namespace of this module. + # But don't override the FEATURES dict because we do that in an additive way. + __config_copy__ = copy.deepcopy(__config__) + + KEYS_WITH_MERGED_VALUES = [ + 'FEATURES', + 'TRACKING_BACKENDS', + 'EVENT_TRACKING_BACKENDS', + 'JWT_AUTH', + 'CELERY_QUEUES', + 'MKTG_URL_LINK_MAP', + 'MKTG_URL_OVERRIDES', + ] + for key in KEYS_WITH_MERGED_VALUES: + if key in __config_copy__: + del __config_copy__[key] + + vars().update(__config_copy__) + # A file path to a YAML file from which to load all the code revisions currently deployed REVISION_CONFIG_FILE = get_env_setting('REVISION_CFG') diff --git a/lms/envs/production.py b/lms/envs/production.py index dcf8a4592d..c8a1164db2 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -19,6 +19,7 @@ Common traits: import codecs +import copy import datetime import os @@ -55,6 +56,26 @@ with codecs.open(CONFIG_FILE, encoding='utf-8') as f: ENV_TOKENS = __config__ AUTH_TOKENS = __config__ + # Add the key/values from config into the global namespace of this module. + # But don't override the FEATURES dict because we do that in an additive way. + __config_copy__ = copy.deepcopy(__config__) + + KEYS_WITH_MERGED_VALUES = [ + 'FEATURES', + 'TRACKING_BACKENDS', + 'EVENT_TRACKING_BACKENDS', + 'JWT_AUTH', + 'CELERY_QUEUES', + 'MKTG_URL_LINK_MAP', + 'MKTG_URL_OVERRIDES', + ] + for key in KEYS_WITH_MERGED_VALUES: + if key in __config_copy__: + del __config_copy__[key] + + vars().update(__config_copy__) + + # A file path to a YAML file from which to load all the code revisions currently deployed REVISION_CONFIG_FILE = get_env_setting('REVISION_CFG')