config_drive

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CallBack func(v *viper.Viper)

Functions

func GetConfig

func GetConfig() *viper.Viper

func Init

func Init(conf *Config) *viper.Viper

Types

type CallFunc

type CallFunc func(v *viper.Viper)

type Config

type Config struct {
	Drive    string //中间件 etcd/consul/zk
	Host     string //连接地址
	Type     string //配置数据格式 json\yaml...
	Username string //连接用户名
	Password string //连接密码
	Path     string //配置存储目录
	Token    string //连接的token
}

type ConfigService

type ConfigService interface {
	Init() *viper.Viper
	GetViper(v *viper.Viper) error
	Get() ([]byte, error)
	Watch(v *viper.Viper)
	Set(value string) error
	SetPath(key string)
}

func NewConsul

func NewConsul(conf *Config) (ConfigService, error)

NewConsul 创建consul对象,用于获取和监听日志

func NewEtcd

func NewEtcd(conf *Config) (ConfigService, error)

func NewLocal

func NewLocal(conf *Config) (ConfigService, error)

func NewZK

func NewZK(conf *Config) (ConfigService, error)

Jump to

Keyboard shortcuts

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