Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foryforx/goconfig
Golang base hierarchial config manager using redis
https://github.com/foryforx/goconfig
config configuration go golang hierarchical-data key-value redis
Last synced: about 2 months ago
JSON representation
Golang base hierarchial config manager using redis
- Host: GitHub
- URL: https://github.com/foryforx/goconfig
- Owner: foryforx
- License: mit
- Created: 2019-06-03T10:33:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-06T12:31:20.000Z (over 5 years ago)
- Last Synced: 2024-03-18T09:10:45.505Z (11 months ago)
- Topics: config, configuration, go, golang, hierarchical-data, key-value, redis
- Language: Go
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GoConfig
This is an hierarchial config manager using redis. In case of website handling multiple country, we might need to maintain a config for payment username. But this key will vary for each country as shown below
payment_username.sg = "hhhhh"
payment_username.au = "yyyyy"
all other countries will use:
payment_username = "aaaaa"In this case, if we feed in all these to our GoConfig
payment_username = "aaaaa"
payment_username.sg = "hhhhh"
payment_username.au = "yyyyy"and
If we ask for
payment_username.kr, it will return back "aaaaa"
payment_username.sg, it will return back "hhhhh" accordingly.
## Installation and Play* go get github.com/karuppaiah/goconfig
* cd $GOPATH/src/github.com/karuppaiah/goconfig
* install dep(https://github.com/golang/dep)
* dep ensure
* cd examples
* go run main.go## Usage
```
// Handle errors accordingly
redisClient, err := config.DefaultRedis("", "", "", 0)
if err != nil {
log.Errorln(err)
}
goConfig := config.NewGoConfig(redisClient, ".")
err = goConfig.Set("a.b.c", "a")
if err != nil {
log.Errorln(err)
}
val, err := goConfig.Get("a.b.c")
if err != nil {
log.Errorln(err)
}
```# TODO :
- [ ] Instead of storing just string values. See possibility to store any type of value.
- [ ] Option to Load Data on startup and keep it in memory from DB
- [ ] Docker image and publish in hub.docker.com
- [ ] Write unit testing
- [ ] Flutter/web assembly frontend to playaround (++)