aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-04-10 16:13:16 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-04-10 16:13:16 -0600
commit0c7ac77127e47f0130ab4961303eedd245c0ca6f (patch)
tree27fa0ea407703606c54d09303eab07afb6ae5328 /main.py
parent7c62833cb3dfc28d279bc72c6a68a7a907488759 (diff)
downloadhatecomputers-dns-updater-0c7ac77127e47f0130ab4961303eedd245c0ca6f.tar.gz
hatecomputers-dns-updater-0c7ac77127e47f0130ab4961303eedd245c0ca6f.zip
initial setup
Diffstat (limited to 'main.py')
-rw-r--r--main.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/main.py b/main.py
new file mode 100644
index 0000000..98cf488
--- /dev/null
+++ b/main.py
@@ -0,0 +1,26 @@
+import json
+import logging
+
+from updater.adapter import HatecomputersDNSAdapter
+from args import get_args
+
+
+def sync_records(adapter, records_path):
+ records_file = open(records_path, "r")
+ dns_records = json.load(records_file)
+ adapter.post_records(dns_records)
+
+
+if __name__ == "__main__":
+ args = get_args()
+ logging.basicConfig()
+ logging.root.setLevel(args.log_level)
+
+ api_key = open(args.api_key_file, "r").read().strip()
+ adapter = HatecomputersDNSAdapter(args.endpoint, api_key)
+
+ if args.sync:
+ sync_records(adapter, args.records_file)
+
+ if args.certbot:
+ logging.info("certbot mode")