27 lines
639 B
Python
27 lines
639 B
Python
|
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")
|