From 242ccb078183a5269b334205e99238b73c97093e Mon Sep 17 00:00:00 2001 From: "Ifechukwu T. Ogidi" Date: Sun, 27 Apr 2025 16:09:15 +0100 Subject: [PATCH] Change params to use broker url --- .env.example | 3 ++- src/config/asgi.py | 2 +- src/env.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 2bcaa21..8590fbc 100644 --- a/.env.example +++ b/.env.example @@ -32,4 +32,5 @@ OTP_LIFETIME=10 API_GATEWAY_PUBLIC_KEY=xxxxxxxxxxxxxxxxxxxxxxxx API_KEY_EXPIRES_AT=2 -RABBITMQ_HOST=localhost \ No newline at end of file +# amqp://username:password@host[:port]/ +RABBITMQ_URL=amqp://guest:guest@localhost:5672/ \ No newline at end of file diff --git a/src/config/asgi.py b/src/config/asgi.py index 3a7ad94..00c0ac7 100644 --- a/src/config/asgi.py +++ b/src/config/asgi.py @@ -16,7 +16,7 @@ from src.env import rabbitmq_config -broker = RabbitBroker(host=rabbitmq_config["host"]) +broker = RabbitBroker(rabbitmq_config["url"]) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.config.settings") diff --git a/src/env.py b/src/env.py index 750d6d0..fcecc4e 100644 --- a/src/env.py +++ b/src/env.py @@ -51,7 +51,7 @@ class OTP(TypedDict): class RabbitMQ(TypedDict): - host: str + url: str env = Env() @@ -109,7 +109,7 @@ class RabbitMQ(TypedDict): otp: OTP = {"lifetime": get_env_int("OTP_LIFETIME")} -rabbitmq_config: RabbitMQ = {"host": get_env_str("RABBITMQ_HOST")} +rabbitmq_config: RabbitMQ = {"url": get_env_str("RABBITMQ_URL")} __all__ = [