Add env var for rabbitmq port

This commit is contained in:
Zoe Roux 2024-04-21 02:04:56 +02:00
parent c576babde8
commit bfbc66cdc0
No known key found for this signature in database
6 changed files with 13 additions and 3 deletions

View File

@ -75,5 +75,6 @@ MEILI_HOST="http://meilisearch:7700"
MEILI_MASTER_KEY="ghvjkgisbgkbgskegblfqbgjkebbhgwkjfb"
RABBITMQ_HOST=rabbitmq
RABBITMQ_PORT=5672
RABBITMQ_DEFAULT_USER=kyoo
RABBITMQ_DEFAULT_PASS=aohohunuhouhuhhoahothonseuhaoensuthoaentsuhha

View File

@ -46,6 +46,7 @@ def main():
connection = pika.BlockingConnection(
pika.ConnectionParameters(
host=os.environ.get("RABBITMQ_HOST", "rabbitmq"),
port=os.environ.get("RABBITMQ_PORT", 5672),
credentials=pika.credentials.PlainCredentials(
os.environ.get("RABBITMQ_DEFAULT_USER", "guest"),
os.environ.get("RABBITMQ_DEFAULT_PASS", "guest"),

View File

@ -56,7 +56,7 @@ class Simkl(Service):
]
},
headers={
"Authorization": f"Bearer {user.external_id["simkl"].token.access_token}",
"Authorization": f"Bearer {user.external_id['simkl'].token.access_token}",
"simkl-api-key": self._api_key,
},
)
@ -85,7 +85,7 @@ class Simkl(Service):
]
},
headers={
"Authorization": f"Bearer {user.external_id["simkl"].token.access_token}",
"Authorization": f"Bearer {user.external_id['simkl'].token.access_token}",
"simkl-api-key": self._api_key,
},
)

View File

@ -35,7 +35,7 @@ public static class RabbitMqModule
UserName = builder.Configuration.GetValue("RABBITMQ_DEFAULT_USER", "guest"),
Password = builder.Configuration.GetValue("RABBITMQ_DEFAULT_PASS", "guest"),
HostName = builder.Configuration.GetValue("RABBITMQ_HOST", "rabbitmq"),
Port = 5672,
Port = builder.Configuration.GetValue("RABBITMQ_Port", 5672),
};
return factory.CreateConnection();

View File

@ -10,27 +10,34 @@ from matcher.matcher import Matcher
logger = logging.getLogger(__name__)
class Message(Struct, tag_field="action", tag=str.lower):
pass
class Scan(Message):
path: str
class Delete(Message):
path: str
class Refresh(Message):
kind: Literal["collection", "show", "movie", "season", "episode"]
id: str
decoder = json.Decoder(Union[Scan, Delete, Refresh])
class Subscriber:
QUEUE = "scanner"
async def __aenter__(self):
self._con = await connect_robust(
host=os.environ.get("RABBITMQ_HOST", "rabbitmq"),
port=int(os.environ.get("RABBITMQ_PORT", "5672")),
login=os.environ.get("RABBITMQ_DEFAULT_USER", "guest"),
password=os.environ.get("RABBITMQ_DEFAULT_PASS", "guest"),
)

View File

@ -9,6 +9,7 @@ class Publisher:
async def __aenter__(self):
self._con = await connect_robust(
host=os.environ.get("RABBITMQ_HOST", "rabbitmq"),
port=int(os.environ.get("RABBITMQ_PORT", "5672")),
login=os.environ.get("RABBITMQ_DEFAULT_USER", "guest"),
password=os.environ.get("RABBITMQ_DEFAULT_PASS", "guest"),
)