Skip to content

Commit

Permalink
update flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanshah18 committed Sep 4, 2024
1 parent 2cc2ce5 commit da7ebc2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
20 changes: 15 additions & 5 deletions src/main/java/io/pinecone/configs/PineconeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class PineconeConfig {
private String sourceTag;
private ProxyConfig proxyConfig;
private ManagedChannel customManagedChannel;
private boolean usePineconeLocal = false;
private boolean enableTLS = true;

/**
* Constructs a {@link PineconeConfig} instance with the specified API key.
Expand Down Expand Up @@ -208,12 +208,22 @@ public String getUserAgent() {
return buildUserAgent();
}

public boolean getUsePineconeLocal() {
return usePineconeLocal;
/**
* Returns true if TLS is enabled or false otherwise.
*
* @return enableTls
*/
public boolean getEnableTLS() {
return enableTLS;
}

public void setPineconeLocal(boolean pineconeLocal) {
this.usePineconeLocal = pineconeLocal;
/**
* Sets whether TLS is enabled.
*
* @param enableTLS true to enable TLS, false to disable it.
*/
public void setEnableTLS(boolean enableTLS) {
this.enableTLS = enableTLS;
}

private String buildUserAgent() {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/pinecone/configs/PineconeConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ private ManagedChannel buildChannel() {
NettyChannelBuilder builder = NettyChannelBuilder.forTarget(endpoint);

try {
if(config.getUsePineconeLocal()) {
builder = builder
.negotiationType(NegotiationType.PLAINTEXT);
}
else {
if(config.getEnableTLS()) {
builder = builder
.overrideAuthority(endpoint)
.negotiationType(NegotiationType.TLS)
.sslContext(GrpcSslContexts.forClient().build())
.userAgent(config.getUserAgent());
}
else {
builder = builder
.negotiationType(NegotiationType.PLAINTEXT);
}

if(config.getProxyConfig() != null) {
ProxyDetector proxyDetector = getProxyDetector();
Expand Down

0 comments on commit da7ebc2

Please sign in to comment.