diff --git a/lms/djangoapps/edxnotes/helpers.py b/lms/djangoapps/edxnotes/helpers.py index 9e64d83769..58cc7bb78f 100644 --- a/lms/djangoapps/edxnotes/helpers.py +++ b/lms/djangoapps/edxnotes/helpers.py @@ -34,8 +34,7 @@ from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError log = logging.getLogger(__name__) -# OAuth2 Client name for edxnotes -CLIENT_NAME = "edx-notes" + DEFAULT_PAGE = 1 DEFAULT_PAGE_SIZE = 25 @@ -56,10 +55,10 @@ def get_edxnotes_id_token(user): Returns generated ID Token for edxnotes. """ try: - notes_application = Application.objects.get(name=CLIENT_NAME) + notes_application = Application.objects.get(name=settings.EDXNOTES_CLIENT_NAME) except Application.DoesNotExist: raise ImproperlyConfigured( - u'OAuth2 Client with name [{}] does not exist.'.format(CLIENT_NAME) + u'OAuth2 Client with name [{}] does not exist.'.format(settings.EDXNOTES_CLIENT_NAME) ) return create_jwt_for_user( user, secret=notes_application.client_secret, aud=notes_application.client_id diff --git a/lms/envs/common.py b/lms/envs/common.py index 8cbb27c148..13c1ccfbe7 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1369,6 +1369,7 @@ PAYMENT_REPORT_GENERATOR_GROUP = 'shoppingcart_report_access' # Configure the LMS to use our stub EdxNotes implementation EDXNOTES_PUBLIC_API = 'http://localhost:18120/api/v1' EDXNOTES_INTERNAL_API = 'http://localhost:18120/api/v1' +EDXNOTES_CLIENT_NAME = "edx-notes" EDXNOTES_CONNECT_TIMEOUT = 0.5 # time in seconds EDXNOTES_READ_TIMEOUT = 1.5 # time in seconds diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index c0043304b9..8b82b22dbd 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -290,3 +290,6 @@ if os.path.isfile(join(dirname(abspath(__file__)), 'private.py')): MODULESTORE = convert_module_store_setting_if_needed(MODULESTORE) SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd' + +EDXNOTES_INTERNAL_API = 'http://edx.devstack.edxnotesapi:18120/api/v1' +EDXNOTES_CLIENT_NAME = 'edx_notes_api-backend-service' diff --git a/lms/envs/production.py b/lms/envs/production.py index 0b9d41c363..efb8efeb1e 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -874,6 +874,7 @@ PROFILE_IMAGE_SIZES_MAP = ENV_TOKENS.get( EDXNOTES_PUBLIC_API = ENV_TOKENS.get('EDXNOTES_PUBLIC_API', EDXNOTES_PUBLIC_API) EDXNOTES_INTERNAL_API = ENV_TOKENS.get('EDXNOTES_INTERNAL_API', EDXNOTES_INTERNAL_API) +EDXNOTES_CLIENT_NAME = ENV_TOKENS.get('EDXNOTES_CLIENT_NAME', EDXNOTES_CLIENT_NAME) EDXNOTES_CONNECT_TIMEOUT = ENV_TOKENS.get('EDXNOTES_CONNECT_TIMEOUT', EDXNOTES_CONNECT_TIMEOUT) EDXNOTES_READ_TIMEOUT = ENV_TOKENS.get('EDXNOTES_READ_TIMEOUT', EDXNOTES_READ_TIMEOUT)