Goconfigure
Configure service via env or etcd.
Install / Use
/learn @abhiyerra/GoconfigureREADME
Deprecated user Viper
goconfigure - Go Library to get configuration from different sources
Introduction
Golang configuration parser via the following ways:
- [X] ENV
- [X] etcd
- [ ] JSON
- [ ] YAML
- [ ] flags
- [ ] ZooKeeper
- [ ] Consul
Example
etcdClient := etcd.NewClient([]string{"http://127.0.0.1:4001"})
config := goconfigure.Config{
Etcd: goconfigure.Etcd{
Client: etcdClient,
Namespace: "goconfigure",
},
}
config.Add("database_url",
"Use etcd for configuration.",
"user=ayerra dbname=goconfigure_example sslmode=disable",
"GOCONFIGURE_DATABASE_URL",
"database_url")
config.SetParser(goconfigure.EnvParser)
dbUrl, err := config.Get("database_url")
To get the value from Etcd change the parser to EtcdParser. The key that is searched for etcd is /goconfigure/database_url. That is it takes the from /:namespace/:key.
All values are returned as string.
Related Skills
node-connect
353.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
