5.12. Feature Flags¶
Feature flags control whether selected pre-release features are enabled.
Certain features may be included in a release which aren't yet fully implemented, or fully tested. By default, these features are disabled and 'hidden', so should not affect normal functionality.
However, these features may be enabled on a 'preview' basis, on the understanding that they may be incomplete or unstable.
Warning
Do not enable preview features unless you are willing to accept the potential risks.
Once a feature is finalised and stable, it will be released officially, and the corresponding feature flag will be removed.
5.12.1. Available Features¶
The following features are currently available.
| name | description | stability | default | 
|---|---|---|---|
| 
 | Enable search features in the Ngenea Hub UI | stable | True | 
| 
 | Enable bandwidth controls in the Ngenea Hub UI | stable | True | 
5.12.2. REST API¶
Features can be listed, enabled, or disabled via the Ngenea Hub REST API.
To list the available features, and whether they're currently enabled
$ curl -s 'http://example.com/api/features/'  -H 'Accept: application/json'  -H "Authorization: Api-Key $TOKEN"
{
    "count": 1,
    "next": null,
    "results": [
        {
            "name": "searchui",
            "description": "Enable search features in the Ngenea Hub UI",
            "enabled": false
        },
        {
            "name": "bandwidth_controls",
            "description": "Enable bandwidth controls in the Ngenea Hub UI",
            "enabled": false,
        }
    ]
}
Individual features are keyed by their name, e.g. http://example.com/api/features/searchui/
To enable a feature, make a PATCH request against the desired feature
$ curl -s -X PATCH 'http://example.com/api/features/searchui/'  -H 'Accept: application/json'  -H "Authorization: Api-Key $TOKEN" -H 'Content-Type: application/json' -d '{"enabled": true}'
[
    {
        "name": "searchui",
        "description": "Enable search features in the Ngenea Hub UI",
        "enabled": true
    },
    ...
]
And similarly, to disable a feature
curl -s -X PATCH 'http://example.com/api/features/searchui/'  -H 'Accept: application/json'  -H "Authorization: Api-Key $TOKEN" -H 'Content-Type: application/json' -d '{"enabled": false}'
Note
It may be necessary to restart the Ngenea Hub service for a feature change to take effect.
5.12.3. ngclient¶
Alternatively, feature flags can be interacted with using ngclient.
To list available features and whether they're currently enabled
$ ngclient features list
 [X]  searchui              Enable search features in the UI
 [ ]  bandwidth_controls    Enable bandwidth controls in the UI
To enable a feature
ngclient features enable bandwidth_controls
And to disable a feature
ngclient features disable bandwidth_controls
See ngclient features for more information.