configurator

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 13 Imported by: 0

README

configurator

配置器

接入 nacos consul yaml 文件

支持 Get Set Watch

详见 ./example/main.go

Documentation

Index

Constants

View Source
const (
	TypeConsul = "consul"
	TypeNacos  = "nacos"
	TypeFile   = "file"
)

配置类型

Variables

This section is empty.

Functions

func NewConsul

func NewConsul(confValue interface{}) *consulInstance

NewConsul ...

func NewFile

func NewFile(confValue interface{}) *fileInstance

NewFile ...

func NewNacos

func NewNacos(confValue interface{}) *nacosInstance

NewNacos ...

Types

type Configurator

type Configurator interface {
	Key(group, key string) string
	Get(group, key string) (string, error)
	Set(group, key, value string) (bool, error)
	Watch(group, key string, cb func(key, value string)) error
}

Configurator ... 配置器接口

func NewConfigurator

func NewConfigurator(confType string, confValue interface{}) Configurator

NewConfigurator ...

type ConsulConfig

type ConsulConfig struct {
	IpAddr string
	Port   uint64
}

ConsulConfig ... consul 配置

type FileConfig

type FileConfig struct {
	Path string
}

FileConfig ... file 配置

type NacosConfig

type NacosConfig struct {
	Scheme      string
	ContextPath string
	IpAddr      string
	Port        uint64
	Namespace   string
	Username    string
	Password    string
}

NacosConfig ... nacos 配置

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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