apollo

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOK        = errors.New("ok")
	ErrNotModify = errors.New("not apollo config modify")
	ErrStop      = errors.New("stop apollo watcher")
)

Functions

func NewSource

func NewSource(opts ...source.Option) source.Source

func Request

func Request(ctx context.Context, requestURL string, connectionConfig *Config, callBack *CallBack) (configData, error)

Request 建立网络请求

func WithApolloHost

func WithApolloHost(cfg *Config) source.Option

Types

type AuthSignature

type AuthSignature struct {
}

AuthSignature apollo 授权

func (*AuthSignature) HTTPHeaders

func (t *AuthSignature) HTTPHeaders(url string, appID string, secret string) map[string][]string

HTTPHeaders HTTPHeaders

type CallBack

type CallBack struct {
	SuccessCallBack   func([]byte, CallBack) (configData, error)
	NotModifyCallBack func() error
	Namespace         string
}

CallBack 请求回调函数

type Config

type Config struct {
	// Host apollo 地址
	Host string
	// AppId apollo appid
	AppId string
	// NameSpace apollo 命名空间
	NameSpace string
	// Cluster 集群名称
	Cluster string
	// Secret 密钥
	Secret string
	// Timeout 超时时间
	Timeout time.Duration
	// IsRetry 是否重试
	IsRetry bool
	// Auth 包头签名
	Auth HTTPAuth
	// ConfigExt 支持的配置扩展名
	ConfigExt configFormat
}

func NewConfig

func NewConfig() *Config

func (*Config) Set

func (cfg *Config) Set(value string) error

Set 解析批量数据输入 按自定义规则设置到需要的字段

func (*Config) String

func (cfg *Config) String() string

type HTTPAuth

type HTTPAuth interface {
	// HTTPHeaders 根据 @url 获取 http 授权请求头
	HTTPHeaders(url string, appID string, secret string) map[string][]string
}

HTTPAuth http 授权

Jump to

Keyboard shortcuts

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