-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: LANGUAGE_COOKIE_NAME is not set by default #507
fix: LANGUAGE_COOKIE_NAME is not set by default #507
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. May also need to update Changelog accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR @cmltaWt0! I understand that you are trying to address a misconfiguration of the edx-platform production settings. Indeed, in the production settings of edx-platform, we currently have (source):
LANGUAGE_COOKIE_NAME = ENV_TOKENS.get('LANGUAGE_COOKIE', None) or ENV_TOKENS.get('LANGUAGE_COOKIE_NAME')
This is all the more unfortunate that the common settings provide a good default value for this setting (source):
LANGUAGE_COOKIE_NAME = "openedx-language-preference"
So I think it would be better if the edx-platform settings could be fixed upstream:
LANGUAGE_COOKIE_NAME = ENV_TOKENS.get('LANGUAGE_COOKIE') or ENV_TOKENS.get('LANGUAGE_COOKIE_NAME', LANGUAGE_COOKIE_NAME)
I understand that it might be easier to get a PR merged in the Tutor nightly branch than in edx-platform. So what I suggest is that you open a PR on the edx-platform repo; if it cannot be immediately merged, get back here and we'll merge this one. Once your PR is merged in edx-platform, revert your change in the Tutor nightly branch.
What do you think?
@@ -35,6 +35,7 @@ | |||
"EMAIL_USE_TLS": {{ "true" if SMTP_USE_TLS else "false" }}, | |||
"HTTPS": "{{ "on" if ENABLE_HTTPS else "off" }}", | |||
"LANGUAGE_CODE": "{{ LANGUAGE_CODE }}", | |||
"LANGUAGE_COOKIE_NAME": "{{ LANGUAGE_COOKIE_NAME }}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather avoid adding too much stuff to the env.json files. Could we replace these two additions (to lms.env.json and cms.env.json) by a single addition to the apps/openedx/settings/partials/common_all.py template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will try this.
@@ -48,6 +48,7 @@ JWT_COMMON_SECRET_KEY: "{{ OPENEDX_SECRET_KEY }}" | |||
JWT_RSA_PRIVATE_KEY: "{{ 2048|rsa_private_key }}" | |||
K8S_NAMESPACE: "openedx" | |||
LANGUAGE_CODE: "en" | |||
LANGUAGE_COOKIE_NAME: "openedx-language-preference" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid adding Tutor configuration variables for every edx-platform setting. My rule of thumb is that if a setting can be easily overridden by a Tutor plugin (e.g: with at most 2-3 patches) then we should not create a new Tutor setting. Instead, Tutor should provide a good default out of the box.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Totally agree.
Thanks a lot in such a good analysis. I was thinking the same way and didn't want to add any line of code to the tutor codebase but fix it in upstream. Will create a PR to the edx-platform and let's hope it will be merged quickly. Simultaneously will changes this PR (to have plan B) based on the best practices you mentioned. |
Regression caused by https://github.com/edx/edx-platform/pull/28796 Details: ``` response.delete_cookie( settings.LANGUAGE_COOKIE_NAME, domain=settings.SHARED_COOKIE_DOMAIN ) caused an Exception due to absence of LANGUAGE_COOKIE_NAME settings variable > production.py LANGUAGE_COOKIE_NAME = ENV_TOKENS.get('LANGUAGE_COOKIE', None) or ENV_TOKENS.get('LANGUAGE_COOKIE_NAME') ```
ea0b4a6
to
a3e436e
Compare
Adding upstream PR https://github.com/edx/edx-platform/pull/29096 Have to keep in mind that maple quick fix should be reverted after upstream PR is merged due to losing the ability to use |
Actually I'm closing this PR as not needed anymore. |
Regression caused by https://github.com/edx/edx-platform/pull/28796
Details:
Exception: