vscode-cql
vscode-cql copied to clipboard
Supporting authentications.
first of all, thanks for make this useful plugin for vs code. during I've used it as editing cql statement, I found that It supports executing the statement within vs code. but there is no way to authenticate to cassandra database. do you have any plan to add the feature at the plugin?
thanks.
Thanks for taking the time to make a feature request! That is a great idea and one that makes perfect sense. I can get this implemented and updated pretty quickly.
Any progress on this?
Hi Lawrence,
May I suggest a full options Object in the user config to instantiate a cassandra-driver singleton. something like:
"cql": {
"contactPoints": ["10.0.0.1", "10.0.0.2"]
"auth": { // will need a factory to get a new instance of authProvider
"provider": "PlainTextAuthProvider",
"user": "username",
"password": "somapassword",
}
"keyspace": "somekeyspace", // none if empty
"policies": // maybe later with localDatacenter and loadbalancing
}
Thank you for the work. If I get the time I will try to fix a PR. In chrunchtime a.t.m. so it could be a while.
c
I've written some code to support authentication in local files("cqlExecutor.js:24") It seems to be worked well, but "cql.execute" error occured. because I don't have any idea of making plugins for vscode and nodejs & typescript, I can't find where to start finding the issue. anyone suggests? or hints?
function executeCqlStatement(statement) {
console.log('Configuring cql statement execution.');
let cassandraAddress = vscode.workspace.getConfiguration("cql")["address"];
let cassandraPort = vscode.workspace.getConfiguration("cql")["port"];
let cassandraConnectionOptions = vscode.workspace.getConfiguration("cql")["connection"];
let cassandraAuth = new cassandra.auth.PlainTextAuthProvider(workspace.getConfiguration("cql")["username"], workspace.getConfiguration("cql")["password"]);
let cassandraKeyspace = workspace.getConfiguration("cql")["keyspace"];
let clientOptions = !!cassandraConnectionOptions
? cassandraConnectionOptions
: {
contactPoints: [cassandraAddress],
hosts: [cassandraAddress],
authProvider: [cassandraAuth],
keyspace : [cassandraKeyspace]
};
You can run your extension in debug mode in vscode. https://code.visualstudio.com/docs/extensions/developing-extensions If you post the error we might be able to help you =)