viper

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 21 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigCommand

func GetConfigCommand() *cobra.Command

Gets the root level command that can be added to any cobra-powered cli to get config* commands.

func NewAccessor

func NewAccessor(opts config.Options) config.Accessor

Creates a config accessor that implements Accessor interface and uses viper to load configs.

Types

type CollectionProxy

type CollectionProxy struct {
	// contains filtered or unexported fields
}

A proxy object for a collection of Viper instances.

func (CollectionProxy) AllSettings

func (c CollectionProxy) AllSettings() map[string]interface{}

func (*CollectionProxy) AutomaticEnv

func (c *CollectionProxy) AutomaticEnv()

func (*CollectionProxy) BindEnv

func (c *CollectionProxy) BindEnv(input ...string) error

func (*CollectionProxy) BindPFlags

func (c *CollectionProxy) BindPFlags(flags *pflag.FlagSet) error

func (CollectionProxy) ConfigFileUsed

func (c CollectionProxy) ConfigFileUsed() string

func (CollectionProxy) ConfigFilesUsed

func (c CollectionProxy) ConfigFilesUsed() []string

func (CollectionProxy) MergeAllConfigs

func (c CollectionProxy) MergeAllConfigs() (all Viper, err error)

func (CollectionProxy) MergeConfig

func (c CollectionProxy) MergeConfig(in io.Reader) error

func (CollectionProxy) OnConfigChange

func (c CollectionProxy) OnConfigChange(run func(in fsnotify.Event))

func (CollectionProxy) ReadInConfig

func (c CollectionProxy) ReadInConfig() error

func (CollectionProxy) WatchConfig

func (c CollectionProxy) WatchConfig()

type Viper

type Viper interface {
	BindPFlags(flags *pflag.FlagSet) error
	BindEnv(input ...string) error
	AutomaticEnv()
	ReadInConfig() error
	OnConfigChange(run func(in fsnotify.Event))
	WatchConfig()
	AllSettings() map[string]interface{}
	ConfigFileUsed() string
	MergeConfig(in io.Reader) error
}

Jump to

Keyboard shortcuts

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