ConfigDependency¶
- class gafaelfawr.dependencies.config.ConfigDependency¶
Bases:
object
Provides the configuration as a dependency.
We want a production deployment to default to one configuration path, but allow that path to be overridden by the test suite and, if the path changes, to reload the configuration (which allows sharing the same set of global singletons across multiple tests). Do this by loading the config dynamically when it’s first requested and reloading it whenever the configuration path is changed.
Attributes Summary
Path to the configuration file.
Methods Summary
__call__
()Load the configuration if necessary and return it.
config
()Load the configuration if necessary and return it.
set_config_path
(path)Change the configuration path and reload the config.
Attributes Documentation
- config_path¶
Path to the configuration file.
Methods Documentation
- config()¶
Load the configuration if necessary and return it.
This is equivalent to using the dependency as a callable except that it’s not async and can therefore be used from non-async functions.
- Return type: