akvo-rsr
akvo-rsr copied to clipboard
Feature flags
Certain features should be behind a flag.
Requirements
Fast to query
A feature might be checked multiple times in one request. The result shouldn't be a request for every check.
Permissions
Features should be able to be tied to users, groups (M&E manager, enumerator, etc.) , or organisations.
Feature targets
- Organisation
- Program
- Project
Prior Art
django-waffle
https://waffle.readthedocs.io/en/stable/types/flag.html
Has custom model. It allows overriding the flag activeness check
Can only use one model. Not sure about speed and caching. Doesn't handle hierarchies at all Has an admin
gargoyle
https://gargoyle-yplan.readthedocs.io/en/latest/usage.html
Allows handling hierarchies, but not of different models Complicated and meh documentation
Provides an admin
Allows creating your own conditions and specifying which switch uses which
django-flags
https://cfpb.github.io/django-flags/api/conditions/
Implementation Options
Feature definition in settings
The types of features can be declared in the settings. This would remove one query to find out which features have been defined in the first place. However, it would probably still require the features themselves to be saved in the DB, thus duplicating data :thinking: