Back to

Package confProxy

Latest Go to latest

The latest major version is .

Published: Oct 9, 2020 | License: Apache-2.0 | Module:



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

DefaultConfDir ...

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

DataSource confu proxy dataSource interface ...

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier