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__ = [