diff --git a/main.py b/main.py index 1c79db3..1d39b5d 100644 --- a/main.py +++ b/main.py @@ -19,9 +19,9 @@ def get_pub_ip() -> str: # https://www.domeneshop.no/admin?view=api with open("/var/lib/secrets/domeneshop.toml") as f: - globals().update(toml.load(f)["secrets"]) -#DOMENESHOP_TOKEN = os.environ["DOMENESHOP_TOKEN"] -#DOMENESHOP_SECRET = os.environ["DOMENESHOP_SECRET"] + c = toml.load(f) +DOMENESHOP_TOKEN = os.environ.get("DOMENESHOP_TOKEN", c["secrets"]["DOMENESHOP_TOKEN"]) +DOMENESHOP_SECRET = os.environ.get("DOMENESHOP_SECRET", c["secrets"]["DOMENESHOP_SECRET"]) IP_ADDRESS = get_pub_ip() # TODO: both ipv4 and ipv6 DOMAINS = { "pbsds.net": { @@ -39,11 +39,11 @@ for domain in client.get_domains(): if record["host"] in RECORDS \ and record["type"] in RECORDS[record["host"]]: print("Found: ", end="") - rich.pretty.pprint(record) + pprint.pprint(record) if record["data"] != IP_ADDRESS: record["data"] = IP_ADDRESS print("Push: ", end="") - rich.pretty.pprint(record) + pprint.pprint(record) client.modify_record(domain_id=domain["id"], record_id=record.pop("id"), record=record) else: print("Nothing done")