From 4e8c976eeffa6728ace15b1f7f7bcd231c63accb Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Tue, 28 Mar 2023 17:17:35 +0200 Subject: [PATCH] feat: config directory as argument --- src/netcup_dns/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/netcup_dns/main.py b/src/netcup_dns/main.py index 693b255..96429dd 100644 --- a/src/netcup_dns/main.py +++ b/src/netcup_dns/main.py @@ -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}')