Skip to content

Commit 187bdde

Browse files
committed
update log in cassandra db
1 parent 594ba81 commit 187bdde

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/lib/cassandra.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ const isAwsKeyspaces = process.env.DB_IS_AWS_KEYSPACES
1616

1717
let client: Client;
1818

19+
console.log(isAwsKeyspaces)
20+
console.log(process.env.DB_CONTACT_POINTS, process.env.DB_LOCAL_DATACENTER, process.env.DB_KEYSPACE)
1921
// Set up Cassandra connection configuration for local and AWS Keyspaces
2022
if (isAwsKeyspaces) {
23+
console.log("Aws athenticate way")
24+
console.log(AWS.config.credentials)
2125
// AWS Keyspaces connection setup
2226
client = new Client({
2327
contactPoints: [process.env.DB_CONTACT_POINTS || 'cassandra.us-east-1.amazonaws.com'], // AWS Keyspaces endpoint
@@ -81,12 +85,13 @@ const ensureTable = async () => {
8185
// Connect to Cassandra
8286
export const connectToCassandra = async () => {
8387
try {
84-
// Ensure the keyspace and table exist before connecting
85-
await ensureKeyspace();
86-
await ensureTable();
87-
88+
// First, connect to the Cassandra cluster
8889
await client.connect();
8990
console.log('Connected to Cassandra');
91+
92+
// Ensure the keyspace and table exist after connecting
93+
await ensureKeyspace();
94+
await ensureTable();
9095
} catch (error) {
9196
console.error('Cassandra connection error:', error);
9297
throw error;

0 commit comments

Comments
 (0)