-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings for different environment don't transform correctly #74
Comments
We have similar requirements (sort of :) ) and we decided to use filter in a specific way and added IsEnabled field which controls a feature status.
|
It strikes me that being able to override any feature as per @tmarkovski's approach should work. Having looked through the source it looks like it comes down to this line where it requires the feature to be enabled otherwise it'll check for conditional features and find the settings loaded from Here's a draft PR that enable supporting such an option. |
Thanks @josephwoodward . I just assumed environment specific setting should work similarly as other settings. Your approach looks on point, thank you. |
@tmarkovski I haven't seen this encountered yet but it is indeed an issue. A contributing factor to this issue is that when .NET Core composes the settings obtained from multiple json files it does not necessarily overwrite existing fields. This same behavior is going to cause a problem with the fix proposed by JosephWoodward. For example, if we start to short circuit evaluation because a feature is set to false how would we override it in a staging configuration? We would need to set the false to something else, maybe 'true'?
But there are two problems with that.
This will need some thought to fix correctly and may require a change to the feature definition schema. For now, the best way to address it without introducing another oddity is to do something like @leonids2005 is doing. |
Sorry, my fault , I was not very attentive to change your definition it should be {
"FeatureManagement": {
"FeatureA": {
"EnabledFor": [
{
"Name": "ProductPlan",
"Parameters": {
"IsEnabled": true,
"AllowedPlans": [
"Developer",
"Production",
"Enterprise"
]
}
}
]
}
}
} |
I have a Development and Staging setup. For some business reasons, I'd like to disable certain features entirely, while enable them with predefined criteria for other environments.
For example, my
appsettings.json
file may have something like thisHowever, I'd like entirely disable this for my Staging configuration.
In my
appsettings.Staging.json
I would like to completely disable the featureIt appears that this is not possible. I also tried specifying different subset in the
AllowedPlans
, but that didn't work either - the environment specific settings file was never processed.Other settings in it work fine.
Is this an expected behavior? Any help would be appreciated. Thanks
The text was updated successfully, but these errors were encountered: