Skip to content

Commit

Permalink
first pass at adding username + password for MQ
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Szendrey committed Aug 15, 2023
1 parent 6cfe408 commit 5872526
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Settings(BaseSettings):
REDIS_PORT: int = 6379
RABBITMQ_HOST: str = "rabbitmq.pyciemss"
RABBITMQ_PORT: int = 5672
RABBITMQ_USERNAME: str = "terarium"
RABBITMQ_PASSWORD: str = "terarium123"


settings = Settings()
8 changes: 7 additions & 1 deletion service/utils/rabbitmq.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pika
from pika.credentials import PlainCredentials
import json
import time
import logging
Expand Down Expand Up @@ -33,7 +34,12 @@ def callback(ch, method, properties, body):


def gen_rabbitmq_hook(job_id):
connection = pika.BlockingConnection(conn_config)
connection = pika.BlockingConnection(
conn_config,
credentials=PlainCredentials(
username=settings.RABBITMQ_USERNAME, password=settings.RABBITMQ_PASSWORD
),
)
channel = connection.channel()

def hook(progress):
Expand Down

0 comments on commit 5872526

Please sign in to comment.