refactor(settings): standardize Constance env overrides to CONSTANCE_ prefix DEV-1976#7230
Open
platreth wants to merge 2 commits into
Open
refactor(settings): standardize Constance env overrides to CONSTANCE_ prefix DEV-1976#7230platreth wants to merge 2 commits into
platreth wants to merge 2 commits into
Conversation
… prefix Rename Constance override env vars to a single CONSTANCE_ prefix: - KOBO_SUPPORT_EMAIL/URL, KOBO_ACADEMY_URL, KOBO_COMMUNITY_URL - USAGE_LIMIT_ENFORCEMENT (env fallback + pytest env) BREAKING: deployments setting the old names must rename them. No backward-compat fallback (matches the existing ASR_MT_GOOGLE_* precedent).
Contributor
noliveleger
requested changes
Jul 9, 2026
| 'in the user interface', | ||
| ), | ||
| 'SUPPORT_EMAIL': ( | ||
| env.str('KOBO_SUPPORT_EMAIL', env.str('DEFAULT_FROM_EMAIL', 'help@kobotoolbox.org')), |
Contributor
There was a problem hiding this comment.
Let's not break the compatibility here.
Just read from the new variable but keep reading from the deprecated one too.
For any deprecated variable. Please log a Deprecation warning instance.
See
Lines 2007 to 2014 in 39416ad
Contributor
Author
There was a problem hiding this comment.
Yes, that's way better! Done
… names Per review: read the CONSTANCE_-prefixed var but fall back to the deprecated name (KOBO_*/bare), emitting a DeprecationWarning when the old name is still set. Adds the _constance_env helper (matches the existing KPI_BROKER_URL -> CELERY_BROKER_URL deprecation idiom).
noliveleger
requested changes
Jul 13, 2026
noliveleger
left a comment
Contributor
There was a problem hiding this comment.
You should also update the PR description.
It does not match what's happening anymore 🙏
| # `django.conf.settings.THE_SETTING` | ||
|
|
||
|
|
||
| def _constance_env(getter, new_key, deprecated_key, default): |
Contributor
There was a problem hiding this comment.
Would you mind to create an utility file where this could be moved out the settings files.
You can also move other helpers present in that file (e.g.: dj_stripe_request_callback_method)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related PRs — must merge together
This is the app-side of a 3-repo Constance env-var standardization:
The kpi app now reads
CONSTANCE_SUPPORT_EMAIL, so shipping one without the others silently drops the support email to its default. Merge/release together.📣 Summary
Standardize all Constance override env vars on a single
CONSTANCE_prefix.📖 Description
The env vars that override Constance defaults used three conventions (bare,
KOBO_,CONSTANCE_). This unifies them onCONSTANCE_, matching the existingCONSTANCE_ASR_MT_GOOGLE_*precedent.Renamed:
KOBO_SUPPORT_EMAIL→CONSTANCE_SUPPORT_EMAILKOBO_SUPPORT_URL→CONSTANCE_SUPPORT_URLKOBO_ACADEMY_URL→CONSTANCE_ACADEMY_URLKOBO_COMMUNITY_URL→CONSTANCE_COMMUNITY_URLUSAGE_LIMIT_ENFORCEMENT→CONSTANCE_USAGE_LIMIT_ENFORCEMENT(env fallback inbase.py+ pytestenvinpyproject.toml)✅ Test plan
test_api_environment.py— both settings axes