Documentation
¶
Overview ¶
Package koanfutil provides utilities for koanf configuration loading.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileResolver ¶
FileResolver returns a koanf.Provider that resolves file:// URIs in string values to their file contents.
Usage:
k := koanf.New(".")
k.Load(file.Provider("config.toml"), toml.Parser())
k.Load(koanfutil.FileResolver(k), nil) // Resolves file:// URIs
String values like "file:///etc/secrets/password" are replaced with the trimmed contents of /etc/secrets/password. Returns error if any file:// URI cannot be resolved.
func WithDefaults ¶
WithDefaults returns a koanf.Provider that provides default values from a struct. The struct fields must have `koanf` tags to define the key names.
Usage:
k := koanf.New(".")
k.Load(koanfutil.WithDefaults(postgres.DefaultConfig()), nil)
k.Load(file.Provider("config.toml"), toml.Parser())
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.