dynaconf icon indicating copy to clipboard operation
dynaconf copied to clipboard

[RFC] Add ability to explicitly disable loaders in object construction

Open JacobCallahan opened this issue 11 months ago • 0 comments

Problem: We're running into an issue (related to #751) where we're unable to disable an external loader in a multi-project environment. One project uses vault, while the other doesn't, and loading vault in that second project causes config conflicts.

Describe the solution you'd like What I'd like to be able to do is to explicitly disable one or more loaders at the class instance level. For example:

settings = Dynaconf(..., disable_loaders=["dynaconf.loaders.vault_loader"])

Describe alternatives you've considered Unfortunately, there don't seem to be many good alternatives. We've used this workaround for a while, but now are seeing issues. This may be due to the attribute access settings._loaders triggering the loading itself.

settings._loaders = [loader for loader in settings._loaders if "vault" not in loader]

An example of this failure can be seen in the checks here: https://github.com/SatelliteQE/broker/actions/runs/5489518057/jobs/10003774330?pr=216

I have an idea of how this could be minimally implemented but haven't dug into all areas where this new attribute may need to be changed.

JacobCallahan avatar Jul 11 '23 20:07 JacobCallahan