Easy way to control your features using redis.
Also available for Java -> JCurtain! Also available for Ruby -> RCurtain!
- GCurtain uses redis to control features, which can be checked by a percentage or a set of users.
feature:[name-of-feature]:percentage
feature:[name-of-feature]:users
- To use GCurtain, first your need to initialize the configuration defining your redis URL (password@ip:port/database). Optionally, you can also configure the default response when the feature is not found, which by default is false.
func getClient(uri string) *redis.Client {
return redis.NewClient(&redis.Options{
Addr: uri,
})
}
- Get the instance of GCurtain.
const uri = "localhost:6379"
var g = new(GCurtain))
g.Init(uri)
- Consult if the curtain is opened for a feature using the method "IsOpen", passing the name of the feature you want to check.
g.IsOpen('feature')
- You can also pass a set of users to be checked.
g.IsOpen('feature', ['user-1','user-2'])
- Start redis server with docker-compose up on the root folder
- Run the GCurtain_test file (go test)
Bug reports and pull requests are welcome on GitHub at https://github.com/wirecardBrasil/gcurtain. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
- Fork it ( https://github.com/wirecardBrasil/gcurtain)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request