Drivers¶
A driver is a source of values. Every driver reads its own struct tag and knows how to find the value for the field in its source.
| Driver | Package | Struct tag | Source |
|---|---|---|---|
| tag | drivers/tag |
any, initial for example |
default values from struct tags |
| yaml | drivers/yaml |
yaml |
YAML files |
| json | drivers/json |
json |
JSON files |
| toml | drivers/toml |
toml |
TOML files |
| ini | drivers/ini |
ini |
INI files |
| properties | drivers/properties |
properties |
.properties files of Java and Spring |
| env | drivers/env |
env |
environment variables and .env files |
| flag | drivers/flag |
flag |
command line flags |
| consul | drivers/consul |
consul |
Consul KV: a key per field, or a document for yaml, json and toml |
| vault | drivers/vault |
vault |
secrets from the KV secrets engine of HashiCorp Vault |
| etcd | drivers/etcd |
etcd |
etcd: a key per field, or a document for yaml, json and toml |
Drivers are added to the manager with tinyconf.WithDriver, the next driver overrides values of the previous one. All drivers support the same set of types.
Need another file format? See Custom formats: a decoder function is enough. Another source? See Custom drivers.