Giter Club home page Giter Club logo

Comments (5)

josephwoodward avatar josephwoodward commented on July 27, 2024 3

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 appsettings.json.

Here's a draft PR that enable supporting such an option.

from featuremanagement-dotnet.

leonids2005 avatar leonids2005 commented on July 27, 2024

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.

{
  "FeatureManagement": {
    "FeatureA": {
      "EnabledFor": [
        {
          "Name": "ProductPlan",
          "Parameters": {
            "IsEnabled": true,
            "AllowedPlans": [
              "Developer",
              "Production",
              "Enterprise"
            ]
          }
        }
      ]
    }
  }
}

from featuremanagement-dotnet.

tmarkovski avatar tmarkovski commented on July 27, 2024

Thanks @josephwoodward . I just assumed environment specific setting should work similarly as other settings. Your approach looks on point, thank you.

from featuremanagement-dotnet.

jimmyca15 avatar jimmyca15 commented on July 27, 2024

@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'?

"FeatureManagement": {
    "FeatureA": true,
    "FeatureA": {
      "EnabledFor": [
        {
          "Name": "ProductPlan",
          "Parameters": {
            "AllowedPlans": [
              "Developer",
              "Production",
              "Enterprise"
            ]
          }
        }
      ]
    }
  }

But there are two problems with that.

  1. It looks odd to define FeatureA twice like that.
  2. 'true' would turn the feature on always, so really we would need to specify a value like "undefined" or really anything other than true or false.

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.

from featuremanagement-dotnet.

leonids2005 avatar leonids2005 commented on July 27, 2024

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"
            ]
          }
        }
      ]
    }
  }
}

from featuremanagement-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.