Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document how to use feature flags with flipper
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Feature Flags | ||
============= | ||
|
||
Feature flags allow specific features to be turned on and off at runtime for a | ||
percentage of users or the enitire site. Feature flags enable: | ||
|
||
- Testing out new features on a limited portion of our users | ||
- Quick rollback when we discover a problem in production | ||
|
||
Process | ||
------- | ||
|
||
1. Surround the new feature's code with a conditional: | ||
|
||
```ruby | ||
if $flipper[:a_name_for_your_feature].enabled?(current_user) | ||
# do the new thing | ||
else | ||
# do the old thing, or maybe nothing | ||
end | ||
``` | ||
|
||
2. In development, enable the feature in the UI (http://localhost:4567/flipper/) | ||
3. Get your feature deployed, ensuring you mention the feature flag in the Pull | ||
Request. Ask a flipper admin (@kytrinyx) to enable your feature. | ||
4. Ensure everything is working in production. | ||
5. **Important**: Create a new pull request that removes all your feature flipper's | ||
conditionals, removing any old code the new feature replaced and all references to | ||
your feature flag. Leaving enabled feature flags in the code increases complexity | ||
and is unacceptable. The feature flag admin will delete the feature flag in the UI | ||
after the PR is merged and deployed successfully. |