snowwolf007cn / agollo

agollo is a golang client for ctrip apollo config center ๐Ÿš€

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

agollo is a golang client for apollo ๐Ÿš€ CircleCI

Go Report Card codebeat badge Coverage Status golang GoDoc GitHub release

Simple chinese

็ฎ€ไฝ“ไธญๆ–‡

Feature

  • Multiple namespace support
  • Fail tolerant
  • Zero dependency
  • Realtime change notification

Required

go 1.9 or later

Installation

    go get -u github.com/philchia/agollo

Usage

Start use default app.properties config file

    agollo.Start()

Start use given config file path

    agollo.StartWithConfFile(name)

Subscribe to updates

    events := agollo.WatchUpdate()
    changeEvent := <-events
    bytes, _ := json.Marshal(changeEvent)
    fmt.Println("event:", string(bytes))

Get apollo values

    agollo.GetStringValue(Key, defaultValue)
    agollo.GetStringValueWithNameSpace(namespace, key, defaultValue)

Get namespace file contents

    agollo.GetNameSpaceContent(namespace, defaultValue)

Get all keys

    agollo.GetAllKeys(namespace)

Subscribe to new namespaces

    agollo.SubscribeToNamespaces("newNamespace1", "newNamespace2")

License

agollo is released under MIT license

About

agollo is a golang client for ctrip apollo config center ๐Ÿš€

License:MIT License


Languages

Language:Go 100.0%