build caddyfile
This commit is contained in:
16
deploy.py
16
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(
|
||||
|
||||
Reference in New Issue
Block a user