Getting Started¶
Installation¶
Install Sitri with Poetry (recommend):
Install Sitri with pip:
Extras packs and providers:
- all - all providers and settings module.
- settings - pydantic, providers with settings-support.
- redis - for redis provider.
- hvac - for HashiCorp Vault provider.
- vedis - for vedis provider.
- pyyaml - for YAML provider.
Basic Usage¶
Basic usage example with System providers (without provider requirements):
In console:
In code:
from sitri.contrib.system import SystemConfigProvider
from sitri import Sitri
conf = Sitri(
config_provider=SystemConfigProvider(prefix="test"),
)
print(conf.get_config("host"))
# Output: example.com
print(conf.config.keys())
# Output: ["host", "password"]
Note
Last output: [\"host\", \"password\"]
Not bug, but future. This behavior is due to the fact that in our example we use providers with the same backend (system environment) and same prefixes for variables (test)
Note
All kwargs in get_config call pipe to get in provider
Config Providers¶
Hint
In this section most part providers require additional libraries. Install instruction for install dependencies in \"Prepare\" subsections.
All providers will be considered separately without Sitri class