{"id":13668503,"url":"https://github.com/philchia/agollo","last_synced_at":"2025-12-24T06:50:04.797Z","repository":{"id":33855861,"uuid":"154251749","full_name":"philchia/agollo","owner":"philchia","description":"agollo is a golang client for ctrip apollo config center 🚀","archived":false,"fork":false,"pushed_at":"2023-07-04T08:07:18.000Z","size":159,"stargazers_count":178,"open_issues_count":4,"forks_count":46,"subscribers_count":7,"default_branch":"v4","last_synced_at":"2024-11-11T04:38:51.704Z","etag":null,"topics":["agollo","apollo","client","ctrip","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philchia.png","metadata":{"files":{"readme":"README.md","changelog":"change.go","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-23T02:50:35.000Z","updated_at":"2024-09-04T14:08:41.000Z","dependencies_parsed_at":"2024-01-14T16:14:23.530Z","dependency_job_id":"a0e46628-2189-4278-9511-ec7dd80ba049","html_url":"https://github.com/philchia/agollo","commit_stats":null,"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philchia%2Fagollo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philchia%2Fagollo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philchia%2Fagollo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philchia%2Fagollo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philchia","download_url":"https://codeload.github.com/philchia/agollo/tar.gz/refs/heads/v4","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251063469,"owners_count":21530834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agollo","apollo","client","ctrip","golang"],"created_at":"2024-08-02T08:00:38.720Z","updated_at":"2025-12-24T06:50:04.742Z","avatar_url":"https://github.com/philchia.png","language":"Go","funding_links":[],"categories":["Microservice","Go"],"sub_categories":[],"readme":"# agollo is a golang client for apollo 🚀 \n\n[![Go Report Card](https://goreportcard.com/badge/github.com/philchia/agollo)](https://goreportcard.com/report/github.com/philchia/agollo)\n[![codebeat badge](https://codebeat.co/badges/e31b4a09-f531-4b74-a86a-775f46436539)](https://codebeat.co/projects/github-com-philchia-agollo-master)\n[![Coverage Status](https://coveralls.io/repos/github/philchia/agollo/badge.svg?branch=v4)](https://coveralls.io/github/philchia/agollo?branch=v4)\n[![golang](https://img.shields.io/badge/Language-Go-green.svg?style=flat)](https://golang.org)\n[![GoDoc](https://godoc.org/github.com/philchia/agollo?status.svg)](https://pkg.go.dev/github.com/philchia/agollo/v4)\n![GitHub release](https://img.shields.io/github/release/philchia/agollo.svg)\n\n**v1:**[![goproxy.cn](https://goproxy.cn/stats/github.com/philchia/agollo/badges/download-count.svg)](https://goproxy.cn)\n**v3:**[![goproxy.cn](https://goproxy.cn/stats/github.com/philchia/agollo/v3/badges/download-count.svg)](https://goproxy.cn)\n**v4:**[![goproxy.cn](https://goproxy.cn/stats/github.com/philchia/agollo/v4/badges/download-count.svg)](https://goproxy.cn)\n\n\n## Feature\n\n* Multiple namespace support\n* Fail tolerant\n* Zero dependency\n* Realtime change notification\n* API to get contents of namespace\n\n## Required\n\n**go 1.11** or later\n\n## Installation\n\n```sh\ngo get -u github.com/philchia/agollo/v4\n```\n\n## Usage\n\n### Import agollo\n\n```golang\nimport \"github.com/philchia/agollo/v4\"\n```\n\n### In order to use agollo, issue a client or use the built-in default client\n\n#### to use the default global client\n\nfor namespaces with the format of properties, you need to specific the full name \n\n```golang\nagollo.Start(\u0026agollo.Conf{\n    AppID:          \"your app id\",\n    Cluster:        \"default\",\n    NameSpaceNames: []string{\"application.properties\"},\n    MetaAddr:       \"your apollo meta addr\",\n})\n```\n\n#### or to issue a new client to embedded into your program\n\n```golang\napollo := agollo.New(\u0026agollo.Conf{\n                            AppID:          \"your app id\",\n                            Cluster:        \"default\",\n                            NameSpaceNames: []string{\"application.properties\"},\n                            MetaAddr:       \"your apollo meta addr\",\n                        })\napollo.Start()\n```\n\n### Set config update callback\n\n```golang\nagollo.OnUpdate(func(event *ChangeEvent) {\n    // do your business logic to handle config update\n})\n```\n\n### Get apollo values\n\n```golang\n// get values in the application.properties default namespace\nval := agollo.GetString(Key)\n// or indicate a namespace\nother := agollo.GetString(key, agollo.WithNamespace(\"other namespace\"))\n```\n\n### Get namespace file contents\n**to get namespace of with a format of properties, you need to specific the full name of the namespace, e.g. namespace.properties in both options and configs**\n```golang\nnamespaceContent := agollo.GetContent(agollo.WithNamespace(\"application.properties\"))\n```\n\n### Get all keys\n\n```golang\nallKyes := agollo.GetAllKeys(namespace)\n```\n\n### Subscribe to new namespaces\n\n```golang\nagollo.SubscribeToNamespaces(\"newNamespace1\", \"newNamespace2\")\n```\n\n## License\n\nagollo is released under MIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilchia%2Fagollo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilchia%2Fagollo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilchia%2Fagollo/lists"}