Hey folks ! Iโ€™m not sure this is the right channel...
# ask-questions
b
Hey folks ! Iโ€™m not sure this is the right channel for that so feel free to redirect me elsewhere if needed ๐Ÿ™‚ I have a specific feature setup I want to implement and I would need help validating if the way I did it is the right way Requirements I want to have a feature flag
ON
in the preview env but
OFF
in the production env, unless you have a specific user attribute (basically, when you are an employee of the company) My setup Enabled environnement: โœ… production โœ… preview Default value:
OFF
Override rules:
โ†’ Preview
if
env
user attribute equal `dev`then serve
ON
(it would be perfect if I would not have to add any condition here)
โ†’ Production
if
employee
user attribute equal
true
then serve
ON
This setup is working fine but itโ€™s strange to me to have to โ€œhackโ€ the served value and to have to activate both env with a served value
OFF
by default Am I missing something? Thanks !
f
You shouldn't need any rules for the preview environment for it to work. Each environment has its own API key. Are you sure you are using the right one in the preview environment?
b
Yep, the API keys are right ๐Ÿ™‚ Here is my setup:
f
Ok, I think I understand now. So you will need one rule for the preview environment (to override the default value), but you don't need to have any targeting conditions. You can delete the
if env = dev
part of the rule and it should still work.
The preview rule will just be "Serve ON"
b
Oh, got it !
But setting the default value to
OFF
is the right way to do it in that particular case? I would have thought that we would be able to override the
Enabled env
variable with forced values but I can live with the way it is right now ๐Ÿ˜„
f
Yes. We plan to eventually let you have a different default value for each environment, but right now there is only one that's shared between all of them, so setting it to OFF makes the most sense currently.
b
Perfect, thanks a lot for you answers ! Cheers