Skip to content

Commit 981901a

Browse files
committed
fix: Update RabbitMQ connection string to use environment variables for credentials
1 parent e7e9887 commit 981901a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test_send_log.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
import os
12
import asyncio
23
import json
34
from datetime import datetime
45

56
import aio_pika
7+
import dotenv
8+
9+
dotenv.load_dotenv() # Load environment variables from .env file
610

711

812
async def send_test_log():
913
"""Send a test log to RabbitMQ."""
1014
# Update with your credentials
1115
connection = await aio_pika.connect_robust(
12-
"amqp://guest:guest@localhost:5672/"
16+
f"amqp://{os.getenv('RABBITMQ_USER')}:{os.getenv('RABBITMQ_PASSWORD')}@localhost:{os.getenv('RABBITMQ_PORT')}/"
1317
)
1418

1519
async with connection:

0 commit comments

Comments
 (0)