confProxy

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfDir = "/home/www/.config/juno-agent"

DefaultConfDir ...

Functions

This section is empty.

Types

type ConfDataSourceMysql

type ConfDataSourceMysql struct {
	Enable bool   // 是否开启用该数据源
	Dsn    string `json:"dsn"`
}

ConfDataSourceMysql mysql dataSource

type ConfProxy

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

ConfProxy confProxy struct

func NewConfProxy

func NewConfProxy(enable bool, confClient DataSource) *ConfProxy

NewConfProxy new instance

func (*ConfProxy) C

func (cp *ConfProxy) C() <-chan *structs.ConfNode

C ...

func (*ConfProxy) Close

func (cp *ConfProxy) Close()

Close ...

func (*ConfProxy) GetRawValues

func (cp *ConfProxy) GetRawValues(ctx echo.Context, rawKey string) (config string, err error)

GetRawValues ...

func (*ConfProxy) GetValues

func (cp *ConfProxy) GetValues(ctx echo.Context, appName, appEnv, target, port string) (config string, err error)

GetValues ...

func (*ConfProxy) ListenAppConfig

func (cp *ConfProxy) ListenAppConfig(ctx echo.Context, appName, appEnv, target, port string, watch bool, internal int) (structs.ContentNode, error)

ListenAppConfig ...

func (*ConfProxy) ListenRawKeyAppConfig

func (cp *ConfProxy) ListenRawKeyAppConfig(ctx echo.Context, rawKey string, watch bool, internal int) (structs.ContentNode, error)

ListenRawKeyAppConfig ...

func (*ConfProxy) Reload

func (cp *ConfProxy) Reload() error

Reload ...

func (*ConfProxy) Start

func (cp *ConfProxy) Start()

Start ...

type Config

type Config struct {
	Dir     string        `json:"dir"` // 配置中心具体配置路径
	Prefix  string        `json:"prefix"`
	Env     []string      `json:"env"`
	Timeout time.Duration // etcd连接超时时间
	Secure  bool
	Enable  bool                // 是否开启开插件
	Mysql   ConfDataSourceMysql `json:"mysql"`
}

Config confProxy config

func DefaultConfig

func DefaultConfig() Config

DefaultConfig default config info

func RawConfig

func RawConfig(key string) *Config

RawConfig ...

func StdConfig

func StdConfig(key string) *Config

StdConfig 返回标准配置信息

func (*Config) Build

func (c *Config) Build() *ConfProxy

Build new the instance

type DataSource

type DataSource interface {
	ListenAppConfig(ctx echo.Context, key string) chan *structs.ConfNode
	GetValues(ctx echo.Context, keys ...string) (map[string]string, error)
	GetRawValues(ctx echo.Context, rawKey string) (map[string]string, error)
	AppConfigScanner() []*structs.ConfNode
	Reload() error
	Stop()
}

DataSource confu proxy dataSource interface ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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