News for hackers. Stuff that matters.
Re:Ask HN: Do you have a guide on how to use feature flags? by jaredsohn on Monday April 04, 2022 @06:22AM (#30904980)
The easiest way to do it is to create environment variables and check against them in code. This allows turning on / off functionality globally. Systems like AWS and Heroku allow toggling them without redeploying.

You can also create features that apply to individual users or if enterprise then to all users in the customer. This can be done by creating some boolean fields in the database (using a single feature_flags json field is recommended because then you don't have to change the schema every time a new feature flag is added.)

And then in code you check against the environment variable or against the user / customer before running changed functionality via a simple if statement.

There are no comments on this comment yet.