viper

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package viper provides a wrapper for the https://github.com/spf13/viper package. It offers a different callback function, to get access to the viper instance. By default, the watcher will automatically unmarshal the data of the defined configuration struct. TODO: add remote features

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOptions   = errors.New("viper-provider: options must be of type viper.Options")
	ErrMandatory = errors.New("viper-provider: viper.Options file-name, path and type are mandatory")
)

Error messages

Functions

This section is empty.

Types

type Options

type Options struct {
	// FileName of the configuration.
	FileName string
	// FileType optional if the filename has no extension.
	FileType string
	// FilePath to look into.
	FilePath string
	// Watch for file changes.
	Watch bool
	// WatchCallback can be defined.
	// By default, the config struct gets updated on changes.
	WatchCallback func(cfg interface{}, viper *viper.Viper, e fsnotify.Event)
	// EnvPrefix
	EnvPrefix string
	// EnvAutomatic check if environment variables match any of the existing keys.
	EnvAutomatic bool
	// EnvBind binds a Viper key to a ENV variable.
	EnvBind []string
}

Options for the viper provider.

Jump to

Keyboard shortcuts

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