Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions kobo/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,24 @@
'in the user interface',
),
'SUPPORT_EMAIL': (
env.str('KOBO_SUPPORT_EMAIL', env.str('DEFAULT_FROM_EMAIL', 'help@kobotoolbox.org')),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

kpi/kobo/settings/base.py

Lines 2007 to 2014 in 39416ad

if not (MONGO_DB_URL := env.str('MONGO_DB_URL', False)):
# ToDo Remove all this block by the end of 2022.
# Update kobo-install accordingly
logging.warning(
'`MONGO_DB_URL` is not found. '
'`KPI_MONGO_HOST`, `KPI_MONGO_PORT`, `KPI_MONGO_NAME`, '
'`KPI_MONGO_USER`, `KPI_MONGO_PASS` '
'are deprecated and will not be supported anymore soon.'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's way better! Done

env.str(
'CONSTANCE_SUPPORT_EMAIL',
env.str('DEFAULT_FROM_EMAIL', 'help@kobotoolbox.org'),
),
'Email address for users to contact, e.g. when they encounter '
'unhandled errors in the application',
),
'SUPPORT_URL': (
env.str('KOBO_SUPPORT_URL', 'https://support.kobotoolbox.org/'),
env.str('CONSTANCE_SUPPORT_URL', 'https://support.kobotoolbox.org/'),
'URL for "KoboToolbox Help Center"',
),
'ACADEMY_URL': (
env.str('KOBO_ACADEMY_URL', 'https://academy.kobotoolbox.org/'),
env.str('CONSTANCE_ACADEMY_URL', 'https://academy.kobotoolbox.org/'),
'URL for "KoboToolbox Community Forum"',
),
'COMMUNITY_URL': (
env.str(
'KOBO_COMMUNITY_URL', 'https://community.kobotoolbox.org/'
'CONSTANCE_COMMUNITY_URL', 'https://community.kobotoolbox.org/'
),
'URL for "KoboToolbox Community Forum"',
),
Expand Down Expand Up @@ -328,7 +331,7 @@
'Require MFA for superusers with a usable password',
),
'USAGE_LIMIT_ENFORCEMENT': (
env.bool('USAGE_LIMIT_ENFORCEMENT', False),
env.bool('CONSTANCE_USAGE_LIMIT_ENFORCEMENT', False),
'For Stripe-enabled instances, determines whether usage limits will be enforced'
'by blocking submissions/NLP actions or deleting stored files.',
),
Expand All @@ -345,10 +348,6 @@
' the operations API. '
)
),
# We are adopting the `CONSTANCE_` prefix as the new standard for all env
# variables that override Constance defaults. Legacy variables (e.g., KOBO_*)
# will be deprecated and migrated to this new pattern after the upcoming
# migration to Constance 4.x
'ASR_MT_GOOGLE_PROJECT_ID': (
env.str('CONSTANCE_ASR_MT_GOOGLE_PROJECT_ID', 'kobo-asr-mt'),
'ID of the Google Cloud project used to access ASR/MT APIs',
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ testpaths = [
'kpi',
'hub',
]
# Add USAGE_LIMIT_ENFORCEMENT here because setting it in
# Add CONSTANCE_USAGE_LIMIT_ENFORCEMENT here because setting it in
# test module doesn't get registered by constance
env = [
'DJANGO_SETTINGS_MODULE=kobo.settings.testing',
'USAGE_LIMIT_ENFORCEMENT=True',
'CONSTANCE_USAGE_LIMIT_ENFORCEMENT=True',
]
addopts = [
'-m not performance',
Expand Down
Loading