agollo

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

README

Agollo - Go Client for Apollo

Build Status GitHub release Coverage Status License GoDoc

Apollo的Golang客户端

Installation

如果还没有安装Go开发环境,请参考以下文档Getting Started ,安装完成后,请执行以下命令:

gopm get github.com/cihub/seelog -v -g
gopm get github.com/zouyx/agollo -v -g

或者

go get -u github.com/cihub/seelog
go get -u github.com/zouyx/agollo

请注意: 最好使用Go 1.8进行开发

Features

  • 实时同步配置
  • 灰度配置

Usage

  • 启动agollo
func main() {
	 go agollo.Start()
}
  • 获取Apollo的配置

    • String
    agollo.GetStringValue(Key,DefaultValue)
    
    • Int
    agollo.GetIntValue(Key,DefaultValue)
    
    • Float
    agollo.GetFloatValue(Key,DefaultValue)
    
    • Bool
    agollo.GetBoolValue(Key,DefaultValue)
    

 后续可支持更多类型

 欢迎查阅 Wiki 或者 godoc 获取更多有用的信息

To Do

  • 客户端容灾

Contribution

License

The project is licensed under the Apache 2 license.

Reference

Apollo : https://github.com/ctripcorp/apollo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBoolValue

func GetBoolValue(key string, defaultValue bool) bool

func GetFloatValue

func GetFloatValue(key string, defaultValue float64) float64

func GetIntValue

func GetIntValue(key string, defaultValue int) int

func GetStringValue

func GetStringValue(key string, defaultValue string) string

func Start

func Start()

start apollo

func StartRefreshConfig

func StartRefreshConfig(component AbsComponent)

func SyncConfig

func SyncConfig() error

Types

type AbsComponent

type AbsComponent interface {
	Start()
}

type ApolloConfig

type ApolloConfig struct {
	AppId          string                 `json:"appId"`
	Cluster        string                 `json:"cluster"`
	NamespaceName  string                 `json:"namespaceName"`
	Configurations map[string]interface{} `json:"configurations"`
	ReleaseKey     string                 `json:"releaseKey"`
	sync.RWMutex
}

func GetCurrentApolloConfig

func GetCurrentApolloConfig() *ApolloConfig

type AppConfig

type AppConfig struct {
	AppId         string `json:"appId"`
	Cluster       string `json:"cluster"`
	NamespaceName string `json:"namespaceName"`
	ReleaseKey    string `json:"releaseKey"`
	Ip            string `json:"ip"`
}

func GetAppConfig

func GetAppConfig() *AppConfig

type AutoRefreshConfigComponent

type AutoRefreshConfigComponent struct {
}

func (*AutoRefreshConfigComponent) Start

func (this *AutoRefreshConfigComponent) Start()

type NotifyConfigComponent

type NotifyConfigComponent struct {
}

func (*NotifyConfigComponent) Start

func (this *NotifyConfigComponent) Start()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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