Skip to content

Commit 10d5c6a

Browse files
authored
feat: Enable users to customize the host and port for local resolver (#80)
Enable users to customize the host and port to connect to a local resolver
1 parent 19d2809 commit 10d5c6a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/main/java/com/spotify/confidence/ConfidenceFeatureProvider.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public class ConfidenceFeatureProvider implements FeatureProvider {
5050
* ConfidenceFeatureProvider constructor
5151
*
5252
* @param clientSecret generated from Confidence
53-
* @param managedChannel for testing
53+
* @param managedChannel gRPC channel
5454
*/
55-
ConfidenceFeatureProvider(String clientSecret, ManagedChannel managedChannel) {
55+
public ConfidenceFeatureProvider(String clientSecret, ManagedChannel managedChannel) {
5656
this.clientSecret = clientSecret;
5757
this.managedChannel = managedChannel;
5858
this.stub = FlagResolverServiceGrpc.newBlockingStub(managedChannel);
@@ -79,6 +79,18 @@ public ConfidenceFeatureProvider(String clientSecret) {
7979
this(clientSecret, ManagedChannelBuilder.forAddress("edge-grpc.spotify.com", 443).build());
8080
}
8181

82+
/**
83+
* ConfidenceFeatureProvider constructor that allows you to override the default gRPC host and
84+
* port, used for local resolver.
85+
*
86+
* @param clientSecret generated from Confidence
87+
* @param host gRPC host you want to connect to.
88+
* @param port port of the gRPC host that you want to use.
89+
*/
90+
public ConfidenceFeatureProvider(String clientSecret, String host, int port) {
91+
this(clientSecret, ManagedChannelBuilder.forAddress(host, port).build());
92+
}
93+
8294
@Override
8395
public Metadata getMetadata() {
8496
return () -> "com.spotify.confidence.flags.resolver.v1.FlagResolverService";

0 commit comments

Comments
 (0)