Skip to content

Instantly share code, notes, and snippets.



Last active Mar 10, 2020
What would you like to do?
some feature toggle
"active" : true

This comment has been minimized.

Copy link
Owner Author

@Nimrod007 Nimrod007 commented Mar 10, 2020

Dead Simple Feature Toggle
Sometimes you need a feature toggle in a rush … or just dont want to invest time in adding a feature toggle framework…

This thought came to me while I was working on some bot and had to protect myself with a feature toggle, problem was the bot was written with micro services, some in scala, some in java, some in php and even bash …

Main idea was to hold a centralised location with the feature toggle state, each service can obtain this state.

Ive made a list of the feature toggle requirement:

  • Protected with some kind of Auth
  • NO SSH to production machines.
  • Not code changes (in app), no deployments to change state
  • Change feature toggle state from any device with internet (phone, laptop, internet cafe etc…)
  • Hold record of state change (to know who and when changed the feature toggle state)

End result:

  • GitHub repo/gist with json file holding the feature toggle state –
  • Easy to login and change the json with any device.
  • GitHub availability is high.
  • Each gist/repo has a change log so tracking changes is easy
  • Each micro-service will make a HTTP GET request to get the feature toggle state (this is expensive IO but can be reduced with caching on a file on the system that each micro-service can read from if needed)
  • Its FREE!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment