Summary
main/settings.py declares ECOMMERCE_DEFAULT_PAYMENT_GATEWAY via get_string(...), but that name is already registered a few hundred lines earlier through import_settings_modules("mitol.payment_gateway.settings", ...), which itself calls get_string(name="ECOMMERCE_DEFAULT_PAYMENT_GATEWAY", ...).
mitol.common.envs's registry raises if the same env var name is declared twice within one process:
ValueError: Environment variable 'ECOMMERCE_DEFAULT_PAYMENT_GATEWAY' was used more than once
This currently crashes every Django management command on main (manage.py check, manage.py migrate, pytest via pytest-django, etc.), and is failing CI (python-checks and all python-tests shards) on every open PR, including #3802.
Where it was introduced
Introduced by #3810 ("Add learner refund request workflow"), which replaced:
if ECOMMERCE_DEFAULT_PAYMENT_GATEWAY == "None": # noqa: F405
ECOMMERCE_DEFAULT_PAYMENT_GATEWAY = MITOL_PAYMENT_GATEWAY_CYBERSOURCE
with a redundant get_string() declaration on top of it (main/settings.py:1655-1662), duplicating what mitol/payment_gateway/settings/__init__.py already declares.
Fix
Drop the redundant get_string() call in main/settings.py and keep only the "None" → CyberSource normalization that already existed before #3810.
Fix: #PR_NUMBER
Summary
main/settings.pydeclaresECOMMERCE_DEFAULT_PAYMENT_GATEWAYviaget_string(...), but that name is already registered a few hundred lines earlier throughimport_settings_modules("mitol.payment_gateway.settings", ...), which itself callsget_string(name="ECOMMERCE_DEFAULT_PAYMENT_GATEWAY", ...).mitol.common.envs's registry raises if the same env var name is declared twice within one process:This currently crashes every Django management command on
main(manage.py check,manage.py migrate, pytest viapytest-django, etc.), and is failing CI (python-checksand allpython-testsshards) on every open PR, including #3802.Where it was introduced
Introduced by #3810 ("Add learner refund request workflow"), which replaced:
with a redundant
get_string()declaration on top of it (main/settings.py:1655-1662), duplicating whatmitol/payment_gateway/settings/__init__.pyalready declares.Fix
Drop the redundant
get_string()call inmain/settings.pyand keep only the"None"→ CyberSource normalization that already existed before #3810.Fix: #PR_NUMBER