From f316d7b79adca4c4247f51435a5d8e4e8cfb7a31 Mon Sep 17 00:00:00 2001 From: Daniel McCrystal Date: Wed, 30 Jul 2025 22:29:01 -0400 Subject: [PATCH] build caddyfile --- deploy.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/deploy.py b/deploy.py index 110b25d..376f81e 100644 --- a/deploy.py +++ b/deploy.py @@ -3,6 +3,7 @@ from dataclasses import dataclass import subprocess import os from time import time +from textwrap import dedent @dataclass @@ -26,6 +27,21 @@ by_branch = { } +def build_caddyfile(): + excluded = {"deployer"} + with open("Caddyfile", "w+") as file: + for domain, port in map(itemgetter("domain", "port"), by_branch.values()): + if domain in excluded: + continue + + entry = f""" + {domain}.drm.dev {{ + reverse_proxy localhost:{port} + }} + """ + file.write(dedent(entry)) + + def handle_request(rq: DeployerRequest): if (rq.user, rq.repo, rq.branch) not in by_branch: print(