From 1dd7333798d8d5acc3bdd5ecd314a2bf8f25e4d5 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Wed, 6 Jul 2022 23:04:00 +0200 Subject: [PATCH] fix shit --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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")