I came across this when I tried to add a custom 2FA backend.
The library uses APISettings from DRF as a base class for TrenchAPISettings:
class TrenchAPISettings(APISettings):
_FIELD_USER_SETTINGS = "_user_settings"
_FIELD_TRENCH_AUTH = "TRENCH_AUTH"
This wouldn't be a big deal if the TrenchAPISettings would not parse defaults during config load. Effectively, making it impossible to add any new custom backends.
There is a silent KeyError thrown by for k, v in self.defaults[self._FIELD_MFA_METHODS][method_name].items(): and the only way to get around it is to monkey-patch the constant and override trench_settings.
It is worth mentioning that aforementioned DRF's APISettings explicitly states within its implementation that:
This is an internal class that is only compatible with settings namespaced
under the REST_FRAMEWORK name. It is not intended to be used by 3rd-party
apps, and test helpers like `override_settings` may not work as expected.