summaryrefslogtreecommitdiff
path: root/manage.py
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-12-22 16:01:53 +0100
committerxengineering <mail2xengineering@protonmail.com>2020-12-22 16:01:53 +0100
commit699bf610169daeb47bdcc894eb13fa1a706dc50b (patch)
tree66b3f619fece14608e83d98228ec9c200dcbc236 /manage.py
parent7a89708c46b33d6d91164ff66d86d3c2471f531a (diff)
downloadweb-template-699bf610169daeb47bdcc894eb13fa1a706dc50b.tar
web-template-699bf610169daeb47bdcc894eb13fa1a706dc50b.tar.zst
web-template-699bf610169daeb47bdcc894eb13fa1a706dc50b.zip
Switch to static Web App
Diffstat (limited to 'manage.py')
-rwxr-xr-xmanage.py45
1 files changed, 45 insertions, 0 deletions
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
+