microsoft / FeatureManagement-Dotnet

Microsoft.FeatureManagement provides standardized APIs for enabling feature flags within applications. Utilize this library to secure a consistent experience when developing applications that use patterns such as beta access, rollout, dark deployments, and more.
MIT License
1.05k stars 115 forks source link

IFeatureManager.GetFeatureNamesAsync returning all configuration keys #55

Closed satuday closed 4 years ago

satuday commented 4 years ago

I dont have a 'FeatureManagement' section in my appsettings.json, but when I call GetFeatureNamesAsync, it is returning key in IConfiguration.

I'd also try adding 'FeatureManagement' section without any feature set, but the result was the same.

the following are some of the names return from GetFeatureNamesAsync()

"AllowedHosts"
"ALLUSERSPROFILE"
"APPDATA"
"applicationName"
"APP_POOL_CONFIG"
"APP_POOL_ID"
"ASPNETCORE_ENVIRONMENT"
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES"
"ASPNETCORE_IIS_HTTPAUTH"
"ASPNETCORE_IIS_PHYSICAL_PATH"
jimmyca15 commented 4 years ago

Hello @satuday,

When no FeatureManagement section is provided the library treats the root of the registered IConfiguration as the featuremanagement section. This is detailed in the readme.

Using a FeatureManagement section would be the proper method to prevent all configuration keys from being returned from this API. Otherwise, there is no way to distinguish a non-feature configuration key vs a feature configuration key.

jimmyca15 commented 4 years ago

Closing by design. To avoid this please use a "FeatureManagement" section in the application's configuration or pass in an IConfiguration instance which does not contain non-features.

JakeRoper4 commented 4 years ago

@satuday Hello, I've recently just come across this same issue whilst testing integration with Azure App Configuration and its feature management functionality. Did you manage to get around this using the above steps? Or did you find a different approach that perhaps you could share?

satuday commented 4 years ago

Unfortunately I did not. I stopped using the feature manager and switched to launchdarkly.

jgn-epp commented 2 years ago

Super confusing behavior IMO