File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -9,24 +9,20 @@ AWS.config.update({
9
9
// Optionally, configure AWS credentials (from environment or IAM role)
10
10
} ) ;
11
11
12
- const isAwsKeyspaces = process . env . DB_IS_AWS_KEYSPACES === 'true' ; // Detect if connecting to AWS Keyspaces
12
+ const isAwsKeyspaces = process . env . DB_IS_AWS_KEYSPACES
13
+ ? process . env . DB_IS_AWS_KEYSPACES === 'true'
14
+ : true ;
13
15
14
16
let client : Client ;
15
17
16
18
// Set up Cassandra connection configuration for local and AWS Keyspaces
17
19
if ( isAwsKeyspaces ) {
18
20
// AWS Keyspaces connection setup
19
- const credentials = new AWS . Credentials ( {
20
- accessKeyId : process . env . AWS_ACCESS_KEY_ID ,
21
- secretAccessKey : process . env . AWS_SECRET_ACCESS_KEY ,
22
- sessionToken : process . env . AWS_SESSION_TOKEN , // Use temporary credentials if needed
23
- } ) ;
24
-
25
21
client = new Client ( {
26
22
contactPoints : [ process . env . DB_CONTACT_POINTS || 'cassandra.us-east-1.amazonaws.com' ] , // AWS Keyspaces endpoint
27
23
localDataCenter : process . env . DB_LOCAL_DATACENTER || 'us-east-1' ,
28
24
keyspace : process . env . DB_KEYSPACE || 'your_keyspace' ,
29
- authProvider : new Cassandra . AwsAuthProvider ( credentials ) , // AWS IAM for authentication
25
+ authProvider : new Cassandra . AwsAuthProvider ( AWS . config . credentials ) , // AWS IAM for authentication
30
26
sslOptions : { rejectUnauthorized : true } , // Enable SSL for AWS Keyspaces
31
27
} ) ;
32
28
} else {
You can’t perform that action at this time.
0 commit comments