From 0f7995f0c247ed53ba223ecce625df53f0d09ed5 Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Thu, 12 Dec 2024 12:07:54 -0800 Subject: [PATCH] feat: Add domain env variable support --- backend-flask/models/event.py | 5 ++++- docker-compose.prod.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend-flask/models/event.py b/backend-flask/models/event.py index 4ccf78f..4edc715 100644 --- a/backend-flask/models/event.py +++ b/backend-flask/models/event.py @@ -10,6 +10,7 @@ from sqlalchemy_utc import UtcDateTime from discord_webhook import DiscordWebhook import app_db import spec +import os class Event(app_db.BaseModel): @@ -101,6 +102,8 @@ class Event(app_db.BaseModel): if ringers_needed > 0: ringers_needed_msg = f" **({ringers_needed} ringer(s) needed)**" + domain = os.environ.get("DOMAIN", "availabili.tf") + return "\n".join([ f"# {self.name}", "", @@ -111,7 +114,7 @@ class Event(app_db.BaseModel): f"Max bipartite matching size: {matchings}" + ringers_needed_msg, "", "[Confirm attendance here]" + - f"(https://availabili.tf/team/id/{self.team.id}/events/{self.id})", + f"(https://{domain}/team/id/{self.team.id}/events/{self.id})", ]) def get_or_create_webhook(self): diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 949efc4..15593e9 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -35,6 +35,7 @@ services: - FLASK_CELERY_BROKER_URL=redis://redis:6379/0 - FLASK_CELERY_RESULT_BACKEND=redis://redis:6379/0 - DATABASE_URI=postgresql+psycopg://postgres:password@db:5432/availabilitf + - DOMAIN=availabili.tf.sandvich.xyz depends_on: - redis - db