Skip to content

Commit da7ebc2

Browse files
committed
update flag
1 parent 2cc2ce5 commit da7ebc2

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/main/java/io/pinecone/configs/PineconeConfig.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class PineconeConfig {
5252
private String sourceTag;
5353
private ProxyConfig proxyConfig;
5454
private ManagedChannel customManagedChannel;
55-
private boolean usePineconeLocal = false;
55+
private boolean enableTLS = true;
5656

5757
/**
5858
* Constructs a {@link PineconeConfig} instance with the specified API key.
@@ -208,12 +208,22 @@ public String getUserAgent() {
208208
return buildUserAgent();
209209
}
210210

211-
public boolean getUsePineconeLocal() {
212-
return usePineconeLocal;
211+
/**
212+
* Returns true if TLS is enabled or false otherwise.
213+
*
214+
* @return enableTls
215+
*/
216+
public boolean getEnableTLS() {
217+
return enableTLS;
213218
}
214219

215-
public void setPineconeLocal(boolean pineconeLocal) {
216-
this.usePineconeLocal = pineconeLocal;
220+
/**
221+
* Sets whether TLS is enabled.
222+
*
223+
* @param enableTLS true to enable TLS, false to disable it.
224+
*/
225+
public void setEnableTLS(boolean enableTLS) {
226+
this.enableTLS = enableTLS;
217227
}
218228

219229
private String buildUserAgent() {

src/main/java/io/pinecone/configs/PineconeConnection.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ private ManagedChannel buildChannel() {
139139
NettyChannelBuilder builder = NettyChannelBuilder.forTarget(endpoint);
140140

141141
try {
142-
if(config.getUsePineconeLocal()) {
143-
builder = builder
144-
.negotiationType(NegotiationType.PLAINTEXT);
145-
}
146-
else {
142+
if(config.getEnableTLS()) {
147143
builder = builder
148144
.overrideAuthority(endpoint)
149145
.negotiationType(NegotiationType.TLS)
150146
.sslContext(GrpcSslContexts.forClient().build())
151147
.userAgent(config.getUserAgent());
152148
}
149+
else {
150+
builder = builder
151+
.negotiationType(NegotiationType.PLAINTEXT);
152+
}
153153

154154
if(config.getProxyConfig() != null) {
155155
ProxyDetector proxyDetector = getProxyDetector();

0 commit comments

Comments
 (0)