[config] Fixing GET_FEATURE_FLAGS_FUNC example (#9339)

* [config] Fixing GET_FEATURE_FLAGS_FUNC example

* Adding typing for GET_FEATURE_FLAGS_FUNC

* Update config.py
This commit is contained in:
John Bodley
2020-03-23 13:53:37 -07:00
committed by GitHub
parent f4087d2ad2
commit 5d9857544a

View File

@@ -301,10 +301,11 @@ FEATURE_FLAGS: Dict[str, bool] = {}
# role-based features, or a full on A/B testing framework.
#
# from flask import g, request
# def GET_FEATURE_FLAGS_FUNC(feature_flags_dict):
# feature_flags_dict['some_feature'] = g.user and g.user.id == 5
# def GET_FEATURE_FLAGS_FUNC(feature_flags_dict: Dict[str, bool]) -> Dict[str, bool]:
# if hasattr(g, "user") and g.user.is_active:
# feature_flags_dict['some_feature'] = g.user and g.user.id == 5
# return feature_flags_dict
GET_FEATURE_FLAGS_FUNC = None
GET_FEATURE_FLAGS_FUNC: Optional[Callable[[Dict[str, bool]], Dict[str, bool]]] = None
# ---------------------------------------------------