https://www.growthbook.io/ logo
b

bland-fall-40636

08/09/2022, 9:24 PM
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

future-teacher-7046

08/09/2022, 9:26 PM
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

bland-fall-40636

08/10/2022, 7:50 AM
Yep, the API keys are right πŸ™‚ Here is my setup:
f

future-teacher-7046

08/10/2022, 9:51 AM
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

bland-fall-40636

08/10/2022, 10:07 AM
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

future-teacher-7046

08/10/2022, 10:36 AM
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

bland-fall-40636

08/10/2022, 10:58 AM
Perfect, thanks a lot for you answers ! Cheers