Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/cassandra-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class CassandraClient extends EventEmitter {
this.isInvalid = true;
}

const options: cassandra.ClientOptions = {
var options: cassandra.ClientOptions = {
contactPoints: config.contactPoints,
socketOptions: {
connectTimeout: 60000,
Expand All @@ -59,6 +59,19 @@ export class CassandraClient extends EventEmitter {
// },
};

if ( config.useSSL ) {
var options: cassandra.ClientOptions = {
contactPoints: config.contactPoints,
socketOptions: {
connectTimeout: 60000,
readTimeout: 60000,
},
sslOptions: {
rejectUnauthorized: false
}
}
}

if (config.authProvider && config.authProvider.class === "PasswordAuthenticator") {
options.authProvider = new cassandra.auth.PlainTextAuthProvider(config.authProvider.username, config.authProvider.password);
}
Expand All @@ -73,13 +86,13 @@ export class CassandraClient extends EventEmitter {
return new Promise((resolve, reject) => {

if (!this.nativeClient) {
resolve();
resolve(null);
return;
}

try {
this.nativeClient.shutdown(() => {
resolve();
resolve(null);
});
} catch (e) {
reject(e);
Expand Down
1 change: 1 addition & 0 deletions src/spec/tests/base/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export const configGood: ValidatedConfigClusterItem[] = [
name: "Cluster1",
contactPoints: ["127.0.0.1"],
valid: true,
useSSL: false
},
];
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface PersistedConfigClusterItem {
contactPoints: string[];
port?: number;
authProvider?: WorkbenchConfigAuthProvider;
useSSL: boolean
}

export interface ValidatedConfigClusterItem extends PersistedConfigClusterItem {
Expand Down