Skip to content
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

refactor: Use derived_settings to lazy load settings. #36124

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

feanil
Copy link
Contributor

@feanil feanil commented Jan 16, 2025

Some of our settings depend on the values of other settings. Rather
than explicitly looking up each one in the YAML settings file, we can
simply derive them based on the setting in the YAML file after all the
YAML settings have been loaded.

Some of our settings depend on the values of other settings.  Rather
than explicitly looking up each one in the YAML settings file, we can
simply derive them based on the setting in the YAML file after all the
YAML settings have been loaded.
This was a little hard to grok so I added a little example to make it
easier to understand.
@feanil feanil requested a review from kdmccormick January 16, 2025 20:41
Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified this in the same manner as #36115

Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app@94472ac4abb9:~/edx-platform$ ./diff_settings.sh lms.envs.production lms.envs.production_new
+ DJANGO_SETTINGS_MODULE=lms.envs.production
+ ./settings_wizard.py to-json
+ DJANGO_SETTINGS_MODULE=lms.envs.production_new
+ ./settings_wizard.py to-json
+ diff settings1.json settings2.json
1570,1571d1569
<     "DEFAULT_ENTERPRISE_API_URL": "http://local.openedx.io/enterprise/api/v1/",
<     "DEFAULT_ENTERPRISE_CONSENT_API_URL": "http://local.openedx.io/consent/api/v1/",
1817c1815,1818
<     "ENTERPRISE_CONSENT_API_URL": "http://local.openedx.io/consent/api/v1/",
---
>     "ENTERPRISE_CONSENT_API_URL": {
>         "@@PYREF": "_generate_default_enterprise_consent_api_url",
>         "@@MODULE": "lms.envs.production_new"
>     },

I think you are double-wrapping ENTERPRISE_CONSENT_API_URL-- you don't need lambda settings since it's already being assigned to a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants