From 699bf610169daeb47bdcc894eb13fa1a706dc50b Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 22 Dec 2020 16:01:53 +0100 Subject: Switch to static Web App --- manage.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 manage.py (limited to 'manage.py') diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..50249e5 --- /dev/null +++ b/manage.py @@ -0,0 +1,45 @@ +#!/usr/bin/python3 + + +import sys +import subprocess +import json + + +CONFIG_PATH = "./config.json" + + +def main(): + + if len(sys.argv) != 2: + print("Provide exactly one parameter") + sys.exit(1) + + cfg = read_config() + + command = sys.argv[1] + + if command == "deploy": + for deployment in cfg["deployments"]: + subprocess.call( + "rsync -av ./webroot/ {0}@{1}:{2}".format( + deployment["username"], + deployment["host"], + deployment["webroot"] + ), + shell=True + ) + else: + print("Unknown command") + +def read_config(): + with open(CONFIG_PATH, "r") as f: + content = f.read() + return json.loads(content) + +if __name__ == "__main__": + main() + + +# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab + -- cgit v1.2.3-70-g09d2