Skip to content

Commit c1744d4

Browse files
committed
update keyspace auth
1 parent be47095 commit c1744d4

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/lib/cassandra.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,6 @@ import { SigV4AuthProvider } from 'aws-sigv4-auth-cassandra-plugin'; // Import t
66
import fs from 'fs';
77
import path from 'path';
88

9-
// Load credentials manually if needed
10-
console.log(AWS.config.credentials)
11-
if (!AWS.config.credentials) {
12-
console.log("access_key_id")
13-
console.log(process.env.AWS_ACCESS_KEY_ID)
14-
console.log("access_secret_key")
15-
console.log(process.env.AWS_SECRET_ACCESS_KEY)
16-
AWS.config.update({
17-
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
18-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
19-
region: process.env.AWS_REGION || 'us-east-1', // Optionally, you can also configure the region
20-
});
21-
22-
// AWS.config.credentials = credentials;
23-
}
24-
259
// Set up AWS SDK credentials for AWS Keyspaces (only used if connecting to AWS)
2610
AWS.config.update({
2711
region: process.env.AWS_REGION || 'us-east-1', // Set your region
@@ -34,20 +18,14 @@ const isAwsKeyspaces = process.env.DB_IS_AWS_KEYSPACES
3418

3519
let client: Client;
3620

37-
console.log(isAwsKeyspaces)
38-
console.log(process.env.DB_CONTACT_POINTS, process.env.DB_LOCAL_DATACENTER, process.env.DB_KEYSPACE)
3921
// Set up Cassandra connection configuration for local and AWS Keyspaces
4022
if (isAwsKeyspaces) {
4123
const certPath = path.resolve(process.cwd(), 'sf-class2-root.crt'); // This points to the file inside the container
4224

4325
console.log("Aws athenticate way")
4426
console.log(AWS.config.credentials)
4527

46-
const auth = new SigV4AuthProvider({
47-
region: process.env.AWS_REGION,
48-
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
49-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
50-
});
28+
const auth = new SigV4AuthProvider(AWS.config.credentials);
5129

5230
const sslOptions = {
5331
ca: [fs.readFileSync(certPath, 'utf-8')], // Load the certificate file

0 commit comments

Comments
 (0)