Commit 3b42b765 by Clinton Blackburn

Updated name of environment file

ECOM-6590
parent d1b08ef4
...@@ -6,7 +6,6 @@ import MySQLdb ...@@ -6,7 +6,6 @@ import MySQLdb
import yaml import yaml
from course_discovery.settings.base import * from course_discovery.settings.base import *
from course_discovery.settings.utils import get_env_setting
DEBUG = False DEBUG = False
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
...@@ -22,7 +21,13 @@ DICT_UPDATE_KEYS = ('JWT_AUTH',) ...@@ -22,7 +21,13 @@ DICT_UPDATE_KEYS = ('JWT_AUTH',)
# This may be overridden by the YAML in DISCOVERY_CFG, but it should be here as a default. # This may be overridden by the YAML in DISCOVERY_CFG, but it should be here as a default.
MEDIA_STORAGE_BACKEND = {} MEDIA_STORAGE_BACKEND = {}
CONFIG_FILE = get_env_setting('COURSE_DISCOVERY_CFG') # TODO Drop the try-except block once https://github.com/edx/configuration/pull/3549 is merged and we are using the
# common play for this service.
try:
CONFIG_FILE = environ['DISCOVERY_CFG']
except KeyError:
CONFIG_FILE = environ['COURSE_DISCOVERY_CFG']
with open(CONFIG_FILE) as f: with open(CONFIG_FILE) as f:
config_from_yaml = yaml.load(f) config_from_yaml = yaml.load(f)
...@@ -40,7 +45,6 @@ with open(CONFIG_FILE) as f: ...@@ -40,7 +45,6 @@ with open(CONFIG_FILE) as f:
# It's important we unpack here because of https://github.com/edx/configuration/pull/3307 # It's important we unpack here because of https://github.com/edx/configuration/pull/3307
vars().update(MEDIA_STORAGE_BACKEND) vars().update(MEDIA_STORAGE_BACKEND)
if 'EXTRA_APPS' in locals(): if 'EXTRA_APPS' in locals():
INSTALLED_APPS += EXTRA_APPS INSTALLED_APPS += EXTRA_APPS
......
from os import environ
from django.core.exceptions import ImproperlyConfigured
def get_env_setting(setting):
""" Get the environment setting or raise exception """
try:
return environ[setting]
except KeyError:
error_msg = "Set the [{}] env variable!".format(setting)
raise ImproperlyConfigured(error_msg)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment