Skip to content

apolloconfig/agollo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9660dd0 · May 5, 2024
Oct 13, 2021
Jul 8, 2021
Jul 8, 2021
Mar 27, 2024
Sep 13, 2020
Mar 8, 2024
Jun 30, 2023
Jul 27, 2017
Mar 27, 2024
Jul 30, 2023
Jul 8, 2021
Apr 16, 2020
Jul 9, 2021
Dec 3, 2019
Jun 23, 2017
Sep 29, 2022
Jan 12, 2020
Mar 26, 2024
Mar 26, 2024
Mar 7, 2024
Jul 19, 2023
Jul 8, 2021
Jul 8, 2021
Feb 5, 2023

Repository files navigation

Agollo - Go Client for Apollo

golang Build Status Go Report Card codebeat badge Coverage Status License GoDoc GitHub release 996.icu

方便Golang接入配置中心框架 Apollo 所开发的Golang版本客户端。

Features

  • 支持多 IP、AppID、namespace
  • 实时同步配置
  • 灰度配置
  • 延迟加载(运行时)namespace
  • 客户端,配置文件容灾
  • 自定义日志,缓存组件
  • 支持配置访问秘钥

Usage

快速入门

导入 agollo

go get -u github.com/apolloconfig/agollo/v4@latest

启动 agollo

package main

import (
	"fmt"
	"github.com/apolloconfig/agollo/v4"
	"github.com/apolloconfig/agollo/v4/env/config"
)

func main() {
	c := &config.AppConfig{
		AppID:          "testApplication_yang",
		Cluster:        "dev",
		IP:             "http://106.54.227.205:8080",
		NamespaceName:  "dubbo",
		IsBackupConfig: true,
		Secret:         "6ce3ff7e96a24335a9634fe9abca6d51",
	}

	client, _ := agollo.StartWithConfig(func() (*config.AppConfig, error) {
		return c, nil
	})
	fmt.Println("初始化Apollo配置成功")

	//Use your apollo key to test
	cache := client.GetConfigCache(c.NamespaceName)
	value, _ := cache.Get("key")
	fmt.Println(value)
}

更多用法

使用Demoagollo_demo

其他语言agollo-agent 做本地agent接入,如:PHP

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

如果你觉得该工具还不错或者有问题,一定要让我知道,可以发邮件或者留言

User

Contribution

License

The project is licensed under the Apache 2 license.

Reference

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