Skip to content

Feature names with colon in name are not parsed correctly #90

@peterwurzinger

Description

@peterwurzinger

Given the following configuration:

"FeatureManagement": {
    "Feature1": true,
    "Prefix:Feature2": true
}

Querying the features was a bit surprising at first:

featureManager.IsEnabledAsync("Feature1") //returns true
featureManager.IsEnabledAsync("Prefix:Feature2") //returns false

Listing the feature names is also quite misleading:

featureManager.GetFeatureNamesAsync(); //returns "Feature1", "Prefix"

By taking a closer look, the colon is of course not only a gimmick, but more like a common separator for config sections. So when using the JSON file provider, the abovementioned configuration could also be semantically identical rephrased as

"FeatureManagement": {
    "Feature1": true,
    "Prefix": {
        "Feature2": true
    }
}

And that explains the weird behavior.

To solve that, would it be a possible to tokenize given feature names by : , treating them as config-sections and only the last segment as the name? Imho that would fix the "Prefix":Feature" : true case, as well as enable feature grouping (see above).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions