Hello everyone. Im trialing out growthbook for my ...
# announcements
l
Hello everyone. Im trialing out growthbook for my current company and I'm having to hack around the fact that (please correct me if I'm wrong) a feature flag's
default value
is shared between environments, instead of being distinct to each. Say I have feature
X
working in
test
under a boolean
on/off
flag, so I just want to enable it in
test
and have the default value as
on
. For
prod
I want to
X
to be
off
for everyone except for some internal users, but if I enable it in
prod
and set the default value as
off
it then affects the
test
env. My current hack is to enable the feature in all envs with default value as
on
, then in
prod
adding an override clause that turns on the feature if the userId matches some condition. If there are distinct default values for each env then they are isolated and you won't risk accidentally breaking one when configuring the other. Plus I can see that
override rules
are already env-scoped. So I was just wondering if there are specific reasoning behind making
default value
a global config. I'm very new to feature toggling in general any suggestion/criticism is more than welcome!
f
Hi Thang, thanks for the feedback. I agree it's a little hacky to support your use case currently. I think having env-scoped default values is something we could support in the future. My workflow is usually to keep the default value to
off
and then enable it as needed via override rules. So you could start by forcing the value
on
to everyone in the test environment. And then force it on in prod to specific user ids.
1
l
Thanks for the quick reply! Yes I can see using a common attribute like
loggedIn
to forcefully turn it on for everyone once the feature is stable in a particular env. That would work quite well with the workflow you describe.
f
You can also use a force rule without a condition. That essentially acts like a default value since it will match everyone in the environment.
👀 1
1
l
Nice I didn't know that works as well.
p
A global switch is useful when you discovered a severe defect and turn it off for all envs, a kill switch maybe?