import os import re class Conf: def __init__(self): self.configuration = f"{os.path.dirname(__file__)}/zonetools.conf" self.conf = {} with open(self.configuration, "r") as cf: for line in cf: line = line.rstrip(); if r := re.match('#', line): continue if r := re.match('\s*$', line): continue if r := re.match('([A-Za-z0-9_-]+)\s+(.+)', line): self.conf[r[1]] = r[2] else: print(f"invalid line in site_conf: {line}") exit(1) cf.close() def __getattr__(self, name): if name in self.conf: return self.conf[name] else: return None # vim: set tabstop=4 shiftwidth=4 expandtab smarttab: