Exemple #1
0
func main() {
	Features := features.New(memory.New())

	feature := engine.FeatureFlag{
		Key:     "Feature X",
		Enabled: false,
		Users:   []*engine.User{&engine.User{Id: "*****@*****.**"}},
	}
	Features.Save(feature)

	active, _ := Features.IsEnabled("Feature X")
	fmt.Printf("Is `Feature X` enabled? %t \n", active)

	deactive, _ := Features.IsDisabled("Feature X")
	fmt.Printf("Is `Feature X` disabled? %t \n", deactive)

	Features.With("Feature X", func() {
		fmt.Println("`Feature X` is enabled!")
	})

	Features.Without("Feature X", func() {
		fmt.Println("`Feature X` is disabled!")
	})

	fmt.Printf("Does `[email protected]` have access to `Feature X`? %t \n", Features.UserHasAccess("Feature X", "*****@*****.**"))

}
Exemple #2
0
func main() {
	api := api.NewApi(memory.New())
	api.Run()
}
func (s *S) SetUpTest(c *C) {
	s.Features = features.New(memory.New())
}
Exemple #4
0
func (s *S) SetUpTest(c *C) {
	s.ng = memory.New()
	s.api = api.NewApi(s.ng)
	s.server = httptest.NewServer(s.api.Handler())
	httpClient = requests.NewHTTPClient(s.server.URL)
}