viper

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEF_CONFIG_PATH string = "./configs"
)

Variables

This section is empty.

Functions

func CheckCreateConfigFile

func CheckCreateConfigFile(v *viper.Viper, configFile string) error

func ReadConfig

func ReadConfig(v *viper.Viper, r *ViperReader, baseConfigPath string) error

func ReadYamlConfig

func ReadYamlConfig(configPath string, configFile string, config interface{}) error

Types

type ViperReader

type ViperReader struct {
	ConfigPath string // readers can have diff folder
	Reader     io.Reader
	ConfigFile string
	Create     bool
}

func (*ViperReader) GetConfigPath

func (v *ViperReader) GetConfigPath(configPath string) string

type ViperWrapper

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

func New

func New() *ViperWrapper

func NewByPath

func NewByPath(configPath string) *ViperWrapper

func NewByReaders

func NewByReaders(readers []ViperReader) *ViperWrapper

func (*ViperWrapper) InitViper

func (v *ViperWrapper) InitViper() error

func (*ViperWrapper) UnmarshalViper

func (v *ViperWrapper) UnmarshalViper(config interface{}) error

func (*ViperWrapper) WatchConfig

func (v *ViperWrapper) WatchConfig(config interface{})

only can watch the last file TODO, watch all config files

Jump to

Keyboard shortcuts

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