diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 788e08a110..1645505dd7 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -172,6 +172,11 @@ for name, value in ENV_TOKENS.get("CODE_JAIL", {}).items(): COURSES_WITH_UNSAFE_CODE = ENV_TOKENS.get("COURSES_WITH_UNSAFE_CODE", []) +# If segment.io key specified, load it and turn on segment IO if the feature flag is set +SEGMENT_IO_LMS_KEY = ENV_TOKENS.get('SEGMENT_IO_LMS_KEY') +if SEGMENT_IO_LMS_KEY: + MITX_FEATURES['SEGMENT_IO_LMS'] = ENV_TOKENS.get('SEGMENT_IO_LMS', False) + ############################## SECURE AUTH ITEMS ############### # Secret things: passwords, access keys, etc. diff --git a/lms/envs/common.py b/lms/envs/common.py index 2029715c60..b2c6f15c39 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -102,6 +102,9 @@ MITX_FEATURES = { # Staff Debug tool. 'ENABLE_STUDENT_HISTORY_VIEW': True, + # segment.io for LMS--need to explicitly turn it on on production. + 'SEGMENT_IO_LMS': False, + # Enables the student notes API and UI. 'ENABLE_STUDENT_NOTES': True, diff --git a/lms/envs/dev.py b/lms/envs/dev.py index ac0117ad28..17bce93991 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -244,6 +244,13 @@ MITX_FEATURES['ENABLE_PEARSON_LOGIN'] = False ANALYTICS_SERVER_URL = "http://127.0.0.1:9000/" ANALYTICS_API_KEY = "" +##### segment-io ###### + +# If there's an environment variable set, grab it and turn on segment io +SEGMENT_IO_LMS_KEY = os.environ.get('SEGMENT_IO_LMS_KEY') +if SEGMENT_IO_LMS_KEY: + MITX_FEATURES['SEGMENT_IO_LMS'] = True + ##################################################################### # Lastly, see if the developer has any local overrides. diff --git a/lms/templates/main.html b/lms/templates/main.html index f97c173d0d..b00446d190 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -61,6 +61,8 @@ % endif % endif + <%include file="widgets/segment-io.html" /> + diff --git a/lms/templates/widgets/segment-io.html b/lms/templates/widgets/segment-io.html new file mode 100644 index 0000000000..6b4ace8375 --- /dev/null +++ b/lms/templates/widgets/segment-io.html @@ -0,0 +1,24 @@ +% if settings.MITX_FEATURES.get('SEGMENT_IO_LMS'): + + + +% else: + + + +% endif