Skip to content

Commit

Permalink
feat: add override for the LMS_BASE_URL in various LTI settings
Browse files Browse the repository at this point in the history
... without messing up the rest of your world by changing the LMS base
URL for everyone. Meant for ngrok testing of LTI 1.3.
  • Loading branch information
ashultz0 committed Oct 25, 2022
1 parent cca3ba3 commit 415156c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lti_consumer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ def _(text):
def get_lms_base():
"""
Returns LMS base url to be used as issuer on OAuth2 flows
and in various LTI URLs. For local testing it is often necessary
to override the normal LMS base with a proxy such as ngrok, use
the setting LTI_LMS_BASE_URL_OVERRIDE in your LMS settings if
necessary.
TODO: This needs to be improved and account for Open edX sites and
organizations.
One possible improvement is to use `contentstore.get_lms_link_for_item`
and strip the base domain name.
"""
return settings.LMS_ROOT_URL
if hasattr(settings, 'LTI_LMS_BASE_URL_OVERRIDE'):
return settings.LTI_LMS_BASE_URL_OVERRIDE
else:
return settings.LMS_ROOT_URL


def get_lms_lti_keyset_link(config_id):
Expand Down

0 comments on commit 415156c

Please sign in to comment.