-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add environment parameter in config #246
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @mtwstudios thanks for your contribution this is awesome.
The approach you have is the one I had in mind when writing the issue so it looks good to me.
Despite that, I made some minor change requests in your pull request to avoid changing unused things.
I would also suggest adding some tests where you are testing the environment feature because in your test you are always sending an empty environment
so it will not test that this is working as expected.
And as you said, it could be great if you can add some associated documentation.
Co-authored-by: Thomas Poignant <[email protected]>
Thanks for the feedback @thomaspoignant ! I think I've addressed everything, including the cleanup, and adding tests and docs for the change. Let me know if there's any other changes you think are needed. |
Hey @mtwstudios sorry for the delay in the review. I was testing the solution and tell me if I am wrong but from what I understand with this solution if we configure an env, will have to create a rule to catch the environment. Something like this: new-admin-access:
percentage: 100
true: true
false: false
default: false
rule: env eq "pre" I was wondering if we could not have something easier. new-admin-access:
percentage: 100
true: true
false: false
default: false
environment: pre The goal for me is to be able to dedicate a flag to a specific For me the rule should be, that if we have an My only concern is that we cannot have 2 different configurations for the same flag, and it could be a limitation. |
Kudos, SonarCloud Quality Gate passed! |
Hey @thomaspoignant, yep - with this solution, env would be specified in the rule. The advantage of having it be specified in the rule is that it allows for more flexibility for various use cases. In particular:
I think having
I'm not sure what you mean by this - can you give an example? |
You are right about the usage this is way more extensible to have it in the rules. I will release a new version today containing this new version. |
Description
Checking the current environment / flagging by environment is a common use cases for projects I'm involved in, so this adds environment awareness to feature flags. You can set environment as a field in the Config passed to Init, then check them in rule (e.g.
rule: env == "dev"
)I realize I need to address tests/docs, but wanted to get feedback on the approach first to see if it was acceptable.
Changes include
Closes issue(s)
Resolve #175
Checklist