From 29748877de55b46fb19ae6fd7bd4cea5f7d9f7ad Mon Sep 17 00:00:00 2001 From: Jeff LaJoie Date: Fri, 20 Apr 2018 14:07:14 -0400 Subject: [PATCH] LEARNER-4700: Converts credentials to plugin --- lms/envs/aws.py | 3 --- lms/envs/common.py | 3 --- lms/envs/devstack.py | 3 --- lms/envs/test.py | 3 --- openedx/core/djangoapps/credentials/apps.py | 25 +++++++++++++++++++ .../credentials/settings/__init__.py | 0 .../djangoapps/credentials/settings/aws.py | 11 ++++++++ .../djangoapps/credentials/settings/common.py | 7 ++++++ .../credentials/settings/devstack.py | 7 ++++++ .../djangoapps/credentials/settings/test.py | 7 ++++++ setup.py | 1 + 11 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 openedx/core/djangoapps/credentials/apps.py create mode 100644 openedx/core/djangoapps/credentials/settings/__init__.py create mode 100644 openedx/core/djangoapps/credentials/settings/aws.py create mode 100644 openedx/core/djangoapps/credentials/settings/common.py create mode 100644 openedx/core/djangoapps/credentials/settings/devstack.py create mode 100644 openedx/core/djangoapps/credentials/settings/test.py diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 8f904bfb29..0f1a55a52c 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -816,9 +816,6 @@ ECOMMERCE_API_TIMEOUT = ENV_TOKENS.get('ECOMMERCE_API_TIMEOUT', ECOMMERCE_API_TI COURSE_CATALOG_API_URL = ENV_TOKENS.get('COURSE_CATALOG_API_URL', COURSE_CATALOG_API_URL) -CREDENTIALS_INTERNAL_SERVICE_URL = ENV_TOKENS.get('CREDENTIALS_INTERNAL_SERVICE_URL', CREDENTIALS_INTERNAL_SERVICE_URL) -CREDENTIALS_PUBLIC_SERVICE_URL = ENV_TOKENS.get('CREDENTIALS_PUBLIC_SERVICE_URL', CREDENTIALS_PUBLIC_SERVICE_URL) - ECOMMERCE_SERVICE_WORKER_USERNAME = ENV_TOKENS.get( 'ECOMMERCE_SERVICE_WORKER_USERNAME', ECOMMERCE_SERVICE_WORKER_USERNAME diff --git a/lms/envs/common.py b/lms/envs/common.py index 8a1b384f85..2b6ecbdebd 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2254,9 +2254,6 @@ INSTALLED_APPS = [ 'sorl.thumbnail', - # Credentials support - 'openedx.core.djangoapps.credentials', - # edx-milestones service 'milestones', diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 5c319e1cf7..71063c6cef 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -217,9 +217,6 @@ if FEATURES.get('ENABLE_THIRD_PARTY_AUTH') and 'third_party_auth.dummy.DummyBack ############## ECOMMERCE API CONFIGURATION SETTINGS ############### ECOMMERCE_PUBLIC_URL_ROOT = "http://localhost:8002" -CREDENTIALS_INTERNAL_SERVICE_URL = 'http://localhost:8008' -CREDENTIALS_PUBLIC_SERVICE_URL = 'http://localhost:8008' - ###################### Cross-domain requests ###################### FEATURES['ENABLE_CORS_HEADERS'] = True CORS_ALLOW_CREDENTIALS = True diff --git a/lms/envs/test.py b/lms/envs/test.py index a6200b8649..d7251f0bc3 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -561,9 +561,6 @@ JWT_AUTH.update({ COURSE_CATALOG_API_URL = 'https://catalog.example.com/api/v1' -CREDENTIALS_INTERNAL_SERVICE_URL = 'https://credentials-internal.example.com' -CREDENTIALS_PUBLIC_SERVICE_URL = 'https://credentials.example.com' - COMPREHENSIVE_THEME_DIRS = [REPO_ROOT / "themes", REPO_ROOT / "common/test"] COMPREHENSIVE_THEME_LOCALE_PATHS = [REPO_ROOT / "themes/conf/locale", ] diff --git a/openedx/core/djangoapps/credentials/apps.py b/openedx/core/djangoapps/credentials/apps.py new file mode 100644 index 0000000000..6a34f5729f --- /dev/null +++ b/openedx/core/djangoapps/credentials/apps.py @@ -0,0 +1,25 @@ +""" +Credentials Configuration +""" +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ +from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType, PluginSettings + + +class CredentialsConfig(AppConfig): + """ + Configuration class for credentials Django app + """ + name = 'openedx.core.djangoapps.credentials' + verbose_name = _("Credentials") + + plugin_app = { + PluginSettings.CONFIG: { + ProjectType.LMS: { + SettingsType.AWS: {PluginSettings.RELATIVE_PATH: u'settings.aws'}, + SettingsType.COMMON: {PluginSettings.RELATIVE_PATH: u'settings.common'}, + SettingsType.DEVSTACK: {PluginSettings.RELATIVE_PATH: u'settings.devstack'}, + SettingsType.TEST: {PluginSettings.RELATIVE_PATH: u'settings.test'}, + } + } + } diff --git a/openedx/core/djangoapps/credentials/settings/__init__.py b/openedx/core/djangoapps/credentials/settings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openedx/core/djangoapps/credentials/settings/aws.py b/openedx/core/djangoapps/credentials/settings/aws.py new file mode 100644 index 0000000000..f148d9a916 --- /dev/null +++ b/openedx/core/djangoapps/credentials/settings/aws.py @@ -0,0 +1,11 @@ +"""Production settings for Credentials""" + + +def plugin_settings(settings): + # Credentials Settings + settings.CREDENTIALS_INTERNAL_SERVICE_URL = settings.ENV_TOKENS.get( + 'CREDENTIALS_INTERNAL_SERVICE_URL', settings.CREDENTIALS_INTERNAL_SERVICE_URL + ) + settings.CREDENTIALS_PUBLIC_SERVICE_URL = settings.ENV_TOKENS.get( + 'CREDENTIALS_PUBLIC_SERVICE_URL', settings.CREDENTIALS_PUBLIC_SERVICE_URL + ) diff --git a/openedx/core/djangoapps/credentials/settings/common.py b/openedx/core/djangoapps/credentials/settings/common.py new file mode 100644 index 0000000000..d4c422976e --- /dev/null +++ b/openedx/core/djangoapps/credentials/settings/common.py @@ -0,0 +1,7 @@ +"""Common settings for Credentials.""" + + +def plugin_settings(settings): + # Credentials Settings + settings.CREDENTIALS_INTERNAL_SERVICE_URL = 'http://localhost:8008' + settings.CREDENTIALS_PUBLIC_SERVICE_URL = 'http://localhost:8008' diff --git a/openedx/core/djangoapps/credentials/settings/devstack.py b/openedx/core/djangoapps/credentials/settings/devstack.py new file mode 100644 index 0000000000..1c57908ebc --- /dev/null +++ b/openedx/core/djangoapps/credentials/settings/devstack.py @@ -0,0 +1,7 @@ +"""Docker devstack settings for Credentials.""" + + +def plugin_settings(settings): + # Credentials Settings + settings.CREDENTIALS_INTERNAL_SERVICE_URL = 'http://edx.devstack.credentials:18150' + settings.CREDENTIALS_PUBLIC_SERVICE_URL = 'http://localhost:18150' diff --git a/openedx/core/djangoapps/credentials/settings/test.py b/openedx/core/djangoapps/credentials/settings/test.py new file mode 100644 index 0000000000..0fd3be8647 --- /dev/null +++ b/openedx/core/djangoapps/credentials/settings/test.py @@ -0,0 +1,7 @@ +"""Test settings for Credentials.""" + + +def plugin_settings(settings): + # Credentials Settings + settings.CREDENTIALS_INTERNAL_SERVICE_URL = 'https://credentials-internal.example.com' + settings.CREDENTIALS_PUBLIC_SERVICE_URL = 'https://credentials.example.com' diff --git a/setup.py b/setup.py index 46f503a647..d741230b98 100644 --- a/setup.py +++ b/setup.py @@ -66,6 +66,7 @@ setup( ], "lms.djangoapp": [ "ace_common = openedx.core.djangoapps.ace_common.apps:AceCommonConfig", + "credentials = openedx.core.djangoapps.credentials.apps:CredentialsConfig", "discussion = lms.djangoapps.discussion.apps:DiscussionConfig", "grades = lms.djangoapps.grades.apps:GradesConfig", "plugins = openedx.core.djangoapps.plugins.apps:PluginsConfig",