Flask feature flag
pip install flask-feature-flag==0.2.1
Tool to activate and deactivate project functionalities
$ python3 -m venv venv
$ source venv/bin/activate
$ deactivate
Installation
$ pip3 install flask-feature-flag
You should add this to your config.py
FEATURE_FLAGS = {
'ROUTE_ENABLED': os.environ.get('ROUTE_ENABLED', True)
}
FEATURE_FLAGS
is required
Example:
is_enabled
this decorator allows to activate or deactivate a functionality and receives as parameters a function to return in case feature is disabled and the name of the feature
```python
from flask_feature_flag import is_enabled
def error():
return dict(massage='this is a mistake')
@is_enabled(error, 'ENV_HELLO')
def hello(name):
return dict(message=f'Hi, {name}')
```