apollo

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Branch           string
	MasterBranch     = "master"
	DefaultNamespace = "application"
)
View Source
var (
	// the interval for long pool
	PoolInterval = 1 * time.Second
	// the timeout for long pool
	LongPollTimeout = 1*time.Minute + 30*time.Second
)

Functions

func AssignConfWithDefault

func AssignConfWithDefault(defaultBaseConf ApolloBaseConfig, conf ...interface{})

func BindEnv

func BindEnv(config interface{}, prefix string)

func GetSeparator

func GetSeparator() string

func PrintDuration

func PrintDuration(printParam map[string]interface{}) func()

PrintDuration print the time duration function process. printParam contains the fields which will be appeared in the log.

func RefreshConf

func RefreshConf(conf interface{})

func SetSeparator

func SetSeparator(sep string)

Types

type Apollo

type Apollo struct {
	ApolloBaseConfig
	Cluster       string `json:"cluster"`
	NamespaceName string `json:"namespaceName"`
	Config        *ApolloAppConfig
}

func NewApolloConfig

func NewApolloConfig(namespace string, defaultBaseConf ApolloBaseConfig, conf ...interface{}) *Apollo

func (*Apollo) Start

func (a *Apollo) Start(worker chan bool) error

type ApolloAppConfig

type ApolloAppConfig struct {
	AppId          string `json:"appId"`
	Cluster        string `json:"cluster"`
	NamespaceName  string `json:"namespaceName"`
	ReleaseKey     string `json:"releaseKey"`
	Configurations struct {
		Content string `json:"content"`
	} `json:"configurations"`
	InputConf []interface{}
}

func (*ApolloAppConfig) Unmarshal

func (ac *ApolloAppConfig) Unmarshal(rawBytes []byte) error

type ApolloBaseConfig

type ApolloBaseConfig struct {
	AppId            string `json:"appId"`
	Host             string `json:"host"`
	BackupConfigPath string `json:"backupConfigPath"`
	Cluster          string `json:"cluster"`
	SecretKey        string `json:"-"`
}

type Duration

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

func NewDuration

func NewDuration() *Duration

func (*Duration) Get

func (t *Duration) Get() string

func (*Duration) GetAndReset

func (t *Duration) GetAndReset() string

func (*Duration) Reset

func (t *Duration) Reset()

func (*Duration) ToLogger

func (t *Duration) ToLogger() *logrus.Entry

type HttpUtil

type HttpUtil struct {
	Method      string
	Url         string
	RequestBody []byte
	Timeout     time.Duration
	// contains filtered or unexported fields
}

func NewHttpUtil

func NewHttpUtil(secretKey, appID, method, url string, timeout time.Duration, requestBody []byte) *HttpUtil

func (*HttpUtil) Is2xxCode

func (hu *HttpUtil) Is2xxCode(httpCode int) bool

func (*HttpUtil) Request

func (hu *HttpUtil) Request() ([]byte, int, error)

type NotifyComponent

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

func NewNotifyComponent

func NewNotifyComponent(namespace string, worker chan bool) *NotifyComponent

type Refresher

type Refresher interface {
	Refresh()
}

Jump to

Keyboard shortcuts

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