feat: config directory as argument

This commit is contained in:
Daniel Langbein 2023-03-28 17:17:35 +02:00
parent 1d01344067
commit 4e8c976eef

View File

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import configparser
import ipaddress
import sys
from functools import lru_cache
from pathlib import Path
@ -13,7 +14,11 @@ def main():
"""
The main effort is done by https://github.com/nbuchwitz/nc_dnsapi
"""
cfg_dir = Path('cfg')
if len(sys.argv) > 1:
cfg_dir = Path(sys.argv[1])
else:
cfg_dir = Path('/etc/netcup-dns')
if not cfg_dir.exists():
raise Exception(f'The config directory is missing: {cfg_dir}')