Documentation ¶
Overview ¶
Package config provides an application configuration loader base on konf.
Configuration Sources ¶
It loads configuration from the following sources, and each source takes precedence over the sources below it:
- environment variables which matches the following pattern: prefix + "_" + key, all in ALL CAPS. For example, FOO_BAR is the name of environment variable for configuration `foo.bar`.
- config files specified by WithFS and WithFile. WithFile also can be overridden by the environment variable `CONFIG_FILE`. For example, if CONFIG_FILE = "f1, f2,f3", it will load f1, f2, and f3, and each file takes precedence over the files before it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*options)
Option configures the config with specific options.
func WithFS ¶
WithFS provides the fs.FS to load the config files from.
By default, it uses OS file system under the current directory.
func WithFile ¶
WithFile explicitly provides the config file paths, and each file takes precedence over the files before it.
By default, it uses "config/config.yaml". It can be overridden by the environment variable "CONFIG_FILE".
func WithOption ¶
WithOption provides the konf.Option to customize the config.
Click to show internal directories.
Click to hide internal directories.