Skip to content

refactor: Use derived_settings to lazy load settings. - #36124

Closed
feanil wants to merge 2 commits into
masterfrom
feanil/use_derived_tooling
Closed

refactor: Use derived_settings to lazy load settings.#36124
feanil wants to merge 2 commits into
masterfrom
feanil/use_derived_tooling

Conversation

@feanil

@feanil feanil commented Jan 16, 2025

Copy link
Copy Markdown
Contributor

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.

@feanil
feanil requested a review from kdmccormick January 16, 2025 20:41

@kdmccormick kdmccormick left a comment

Copy link
Copy Markdown
Member

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

@kdmccormick kdmccormick left a comment

Copy link
Copy Markdown
Member

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.

@feanil
feanil force-pushed the feanil/use_derived_tooling branch from a21bbac to 0e6a0a6 Compare January 17, 2025 14:17
@feanil
feanil requested a review from kdmccormick January 17, 2025 14:19
@feanil
feanil marked this pull request as ready for review January 17, 2025 15:26
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.

@kdmccormick kdmccormick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm going to push through the Derived Settings API refactor first, and then rebase this on top of that.

@kdmccormick

Copy link
Copy Markdown
Member

Closed in favor of: #36205

@kdmccormick kdmccormick closed this Feb 3, 2025
@feanil
feanil deleted the feanil/use_derived_tooling branch March 3, 2025 20:52
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