Skip to content

RevittConsulting/sft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SFT

Simple Feature Toggles. A simple library for toggling features within your application.


Usage

Create a new instance of sft

  • NewDb() takes a pgxpool
  • NewService() takes a NewBd() (which implements ISimpleFeatureToggleDb), context.Context, and a pgxpool.Pool.

Manage toggles via the dashboard, which is accessed at: ......:6969/dashboard

Once a toggle is created, insert the toggle check into the code of the relevant feature, using CheckFeatureIsEnabled(), which takes a context.Context, and a feature name (string).

Example toggle checking logic:

    enabled, err := h.sft.CheckFeatureIsEnabled(r.Context(), "fix issue")
	if err != nil {
		log.Println("error checking feature: ", err)
	}
	if enabled.Enabled == false {
		log.Println("feature is currently disabled")
		return
	}