feat: Add domain env variable support
							parent
							
								
									f9eb48fc78
								
							
						
					
					
						commit
						0f7995f0c2
					
				| 
						 | 
					@ -10,6 +10,7 @@ from sqlalchemy_utc import UtcDateTime
 | 
				
			||||||
from discord_webhook import DiscordWebhook
 | 
					from discord_webhook import DiscordWebhook
 | 
				
			||||||
import app_db
 | 
					import app_db
 | 
				
			||||||
import spec
 | 
					import spec
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Event(app_db.BaseModel):
 | 
					class Event(app_db.BaseModel):
 | 
				
			||||||
| 
						 | 
					@ -101,6 +102,8 @@ class Event(app_db.BaseModel):
 | 
				
			||||||
        if ringers_needed > 0:
 | 
					        if ringers_needed > 0:
 | 
				
			||||||
            ringers_needed_msg = f" **({ringers_needed} ringer(s) needed)**"
 | 
					            ringers_needed_msg = f" **({ringers_needed} ringer(s) needed)**"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        domain = os.environ.get("DOMAIN", "availabili.tf")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return "\n".join([
 | 
					        return "\n".join([
 | 
				
			||||||
            f"# {self.name}",
 | 
					            f"# {self.name}",
 | 
				
			||||||
            "",
 | 
					            "",
 | 
				
			||||||
| 
						 | 
					@ -111,7 +114,7 @@ class Event(app_db.BaseModel):
 | 
				
			||||||
            f"Max bipartite matching size: {matchings}" + ringers_needed_msg,
 | 
					            f"Max bipartite matching size: {matchings}" + ringers_needed_msg,
 | 
				
			||||||
            "",
 | 
					            "",
 | 
				
			||||||
            "[Confirm attendance here]" +
 | 
					            "[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):
 | 
					    def get_or_create_webhook(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,7 @@ services:
 | 
				
			||||||
      - FLASK_CELERY_BROKER_URL=redis://redis:6379/0
 | 
					      - FLASK_CELERY_BROKER_URL=redis://redis:6379/0
 | 
				
			||||||
      - FLASK_CELERY_RESULT_BACKEND=redis://redis:6379/0
 | 
					      - FLASK_CELERY_RESULT_BACKEND=redis://redis:6379/0
 | 
				
			||||||
      - DATABASE_URI=postgresql+psycopg://postgres:password@db:5432/availabilitf
 | 
					      - DATABASE_URI=postgresql+psycopg://postgres:password@db:5432/availabilitf
 | 
				
			||||||
 | 
					      - DOMAIN=availabili.tf.sandvich.xyz
 | 
				
			||||||
    depends_on:
 | 
					    depends_on:
 | 
				
			||||||
      - redis
 | 
					      - redis
 | 
				
			||||||
      - db
 | 
					      - db
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue