From 8d2becdc47ab6ff955906c9598ea957abda2310e Mon Sep 17 00:00:00 2001 From: drunkendog Date: Fri, 23 Sep 2022 17:15:14 +0100 Subject: [PATCH] Add 'scripts/gotify/main.py' --- scripts/gotify/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 scripts/gotify/main.py diff --git a/scripts/gotify/main.py b/scripts/gotify/main.py new file mode 100644 index 0000000..39cb9ce --- /dev/null +++ b/scripts/gotify/main.py @@ -0,0 +1,12 @@ +import os, sys + +with open("../nginx-site-template.conf", "r") as f: + template = f.read().replace("#serverNameVar", f"{sys.argv[1]}").replace("#http://127.0.0.1:8080/", f"http://172.30.4.1:80/") \ + .replace("proxy_set_header Host $host;", "proxy_set_header Host $host;\n\tproxy_set_header Upgrade $http_upgrade;\n\tproxy_set_header Connection \"upgrade\";") + +with open("/etc/nginx/sites-available/gotify.conf", "w") as f: + f.write(template) + +# depreceated, TODO: replace with os.subprocess +os.system("sh ../nginx-ensite.sh gotify") +os.system("sh launch-docker.sh") \ No newline at end of file