viper

package
v0.0.0-...-012977a Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEnv

func NewEnv()

Types

type EtcdConf

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

func NewEtcd

func NewEtcd(opt ...config.Option) EtcdConf

NewEtcd Etcd 配置

conf := viper.NewFile(

config.Endpoint("http://127.0.0.1:4001"),
config.Path("/config/demo.json"),
config.AddConfig(
	new(redis.Config),
	new(zap.Config),
	new(openObserve.Config),
	new(mysql.Config),
),
config.Watcher(false), // true 开启监控,配置变更执行 Init()

) defer conf.Close()

func (EtcdConf) Close

func (e EtcdConf) Close() error

func (EtcdConf) Init

func (e EtcdConf) Init() error

type FileConf

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

func NewFile

func NewFile(opt ...config.Option) FileConf

NewFile 文件配置

conf := viper.NewFile(
	config.Name("config"),
	config.Path("$HOME/demo"),
	config.AddConfig(
		new(redis.Config),
		new(zap.Config),
		new(openObserve.Config),
		new(mysql.Config),
	),
	config.Watcher(false)
)
defer conf.Close()

func (FileConf) Close

func (f FileConf) Close() error

func (FileConf) Init

func (f FileConf) Init() error

Jump to

Keyboard shortcuts

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