cfgloader

package
v0.0.0-...-fc07508 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadWithOptions

func LoadWithOptions(conf interface{}, defaultConf map[string]interface{}, opts ...Option) (*koanf.Koanf, error)

LoadWithOptions loads config with given options.

func Override

func Override(k *koanf.Koanf, conf interface{}, newValues map[string]interface{}) (*koanf.Koanf, error)

Override overrides the configuration value based on the given newValues.

Types

type Option

type Option func(k *koanf.Koanf) error

func WithConfigFile

func WithConfigFile(configFile string) Option

WithConfigFile loads config from the given file. Currently, supports "yaml" and "json" files.

func WithConfigMap

func WithConfigMap(configMap map[string]interface{}) Option

WithConfigMap loads config from the given configMap which "." separated keys.

func WithEnv

func WithEnv(prefix string) Option

WithEnv loads config from environments. Use Kebab case for proper parsing. For example, The env value "{PREFIX}SERVER_PORT=8080" will be parsed to "server.port=8080". "{PREFIX}SERVER_READ-TIMEOUT=5m" to "server.read-timeout=5m".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL