You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -102,6 +105,27 @@ This is likely to change, but for now here's what they look like:
102
105
}
103
106
]
104
107
}
108
+
,'example_AND_flag': {
109
+
name:'Example AND Flag',
110
+
description:'This flag requires both rules to evaluate to TRUE',
111
+
active:true,
112
+
baseState:false,
113
+
matchRules:'all',
114
+
rules: [
115
+
{
116
+
type:'filter',
117
+
attribute:'role',
118
+
operator:'has',
119
+
comparator: ['writer']
120
+
},
121
+
{
122
+
type:'filter',
123
+
attribute:'betaOptIn',
124
+
operator:'==',
125
+
comparator:true
126
+
}
127
+
]
128
+
}
105
129
,'example_inactive_flag': {
106
130
name:'Example Inactive Flag',
107
131
description:'This flag is false for everyone because it is inactive',
@@ -120,6 +144,12 @@ This is likely to change, but for now here's what they look like:
120
144
-`everybody`: Flag is ON for all users
121
145
- More TBD? If you have ideas, [hit me up!](/atuttle/semaphore/issues)
122
146
147
+
#### AND vs. OR
148
+
149
+
Flags can have multiple rules. At present, Semaphore only supports flag-wide AND/OR: You can require that `ALL` of the rules evaluate to TRUE, or that `ANY` of the rules evaluate to TRUE.
150
+
151
+
The default is `ANY`. If you want to require all rules match, set `matchRules: 'ALL'` on your flag.
152
+
123
153
# Why not just use config settings?
124
154
125
155
You could do that, sure. But the value proposition of feature flags is that they can be toggled independendtly of deploying code changes to your application, and often much more rapidly. They can take effect as quickly as you can update the flag state on your application.
@@ -129,6 +159,7 @@ You could do that, sure. But the value proposition of feature flags is that they
129
159
ALSO, feature flags allow you to dynamically segment the user population. As we'll see below, I've already got support for %-based rollouts, as well as specific user-attribute and environment-attribute filtering.
130
160
131
161
# Why roll your own?
162
+
132
163
I created this because I got fed up trying to implement [FlagSmith](https://flagsmith.com) and [Split.io](https://www.split.io) in my app. They both assume that if you're using Java then you're willing/comfortable using Maven (strike 1), both of their docs barely cover SDK instantiation and I couldn't get either of them even simply on its feet let alone doing something useful (strike 2), and it's (mostly) just "if-statements", right? Why can't we host that ourselves? (strike 3)
0 commit comments