File tree 4 files changed +25
-5
lines changed
main/java/dev.openfeature.contrib.providers.flagsmith
test/java/dev.openfeature.contrib.providers.flagsmith
4 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 30
30
<dependency >
31
31
<groupId >com.flagsmith</groupId >
32
32
<artifactId >flagsmith-java-client</artifactId >
33
- <version >7.4.1 </version >
33
+ <version >7.4.2 </version >
34
34
</dependency >
35
35
36
36
<dependency >
Original file line number Diff line number Diff line change 2
2
3
3
import com .flagsmith .FlagsmithClient ;
4
4
import com .flagsmith .config .FlagsmithCacheConfig ;
5
+ import com .flagsmith .config .FlagsmithConfig ;
5
6
import com .flagsmith .config .Retry ;
6
7
import dev .openfeature .contrib .providers .flagsmith .exceptions .InvalidCacheOptionsException ;
7
8
import dev .openfeature .contrib .providers .flagsmith .exceptions .InvalidOptionsException ;
@@ -88,10 +89,8 @@ private static FlagsmithCacheConfig initializeCacheConfig(FlagsmithProviderOptio
88
89
* @param options The options used to create the provider
89
90
* @return a FlagsmithConfig object with the FlagsmithClient settings
90
91
*/
91
- private static com .flagsmith .config .FlagsmithConfig initializeConfig (
92
- FlagsmithProviderOptions options ) {
93
- com .flagsmith .config .FlagsmithConfig .Builder flagsmithConfig = com .flagsmith .config .FlagsmithConfig
94
- .newBuilder ();
92
+ private static FlagsmithConfig initializeConfig (FlagsmithProviderOptions options ) {
93
+ FlagsmithConfig .Builder flagsmithConfig = FlagsmithConfig .newBuilder ();
95
94
96
95
// Set client level configuration settings
97
96
if (options .getBaseUri () != null ) {
@@ -136,6 +135,10 @@ private static com.flagsmith.config.FlagsmithConfig initializeConfig(
136
135
flagsmithConfig .withEnableAnalytics (options .isEnableAnalytics ());
137
136
}
138
137
138
+ if (options .getSupportedProtocols () != null && !options .getSupportedProtocols ().isEmpty ()) {
139
+ flagsmithConfig .withSupportedProtocols (options .getSupportedProtocols ());
140
+ }
141
+
139
142
return flagsmithConfig .build ();
140
143
}
141
144
Original file line number Diff line number Diff line change 2
2
3
3
import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
4
4
5
+ import com .flagsmith .config .FlagsmithConfig .Protocol ;
6
+ import java .util .Arrays ;
5
7
import java .util .HashMap ;
8
+ import java .util .List ;
6
9
import java .util .concurrent .TimeUnit ;
10
+ import java .util .stream .Collectors ;
11
+
7
12
import lombok .Builder ;
8
13
import lombok .Getter ;
9
14
import javax .net .ssl .SSLSocketFactory ;
@@ -183,4 +188,12 @@ public class FlagsmithProviderOptions {
183
188
*/
184
189
@ Builder .Default
185
190
private boolean usingBooleanConfigValue = false ;
191
+
192
+ /**
193
+ * Set the list of supported protocols that should be used.
194
+ * Optional.
195
+ * Default: All the enum protocols from FlagsmithConfig.
196
+ */
197
+ @ Builder .Default
198
+ private List <Protocol > supportedProtocols = Arrays .stream (Protocol .values ()).collect (Collectors .toList ());
186
199
}
Original file line number Diff line number Diff line change 2
2
3
3
import com .fasterxml .jackson .core .JsonProcessingException ;
4
4
import com .fasterxml .jackson .databind .ObjectMapper ;
5
+ import com .flagsmith .config .FlagsmithConfig ;
5
6
import dev .openfeature .contrib .providers .flagsmith .exceptions .InvalidCacheOptionsException ;
6
7
import dev .openfeature .contrib .providers .flagsmith .exceptions .InvalidOptionsException ;
7
8
import dev .openfeature .sdk .EvaluationContext ;
16
17
import java .lang .reflect .Method ;
17
18
import java .nio .file .Files ;
18
19
import java .nio .file .Paths ;
20
+ import java .util .Arrays ;
21
+ import java .util .Collections ;
19
22
import java .util .HashMap ;
20
23
import java .util .Map ;
21
24
import java .util .concurrent .TimeUnit ;
@@ -191,6 +194,7 @@ void shouldInitializeProviderWhenAllOptionsSet() {
191
194
.environmentRefreshIntervalSeconds (1 )
192
195
.enableAnalytics (true )
193
196
.usingBooleanConfigValue (false )
197
+ .supportedProtocols (Collections .singletonList (FlagsmithConfig .Protocol .HTTP_1_1 ))
194
198
.build ();
195
199
assertDoesNotThrow (() -> new FlagsmithProvider (options ));
196
200
}
You can’t perform that action at this time.
0 commit comments