diff --git a/README.md b/README.md index 5da177a..697714e 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,9 @@ Update DNS records with your current external IP address using the netcup DNS AP ## Configuration -For each netcup customer, create a `.ini` configuration file. Here is an example: +For each netcup customer, create a `.ini` configuration file. -```ini -[credentials] -customer = 123456 -api_key = abcdefghijklmnopqrstuvwxyz -api_password = abcdefghijklmnopqrstuvwxyz - -[example.com] -hostname = @ -type = A - -[foo.bar] -hostname = @ -type = A -``` +There is an [example configuration](cfg/example.ini). ## TODOs diff --git a/cfg/example.ini b/cfg/example.ini new file mode 100644 index 0000000..2195b40 --- /dev/null +++ b/cfg/example.ini @@ -0,0 +1,12 @@ +;[credentials] +;customer = 123456 +;api_key = abcdefghijklmnopqrstuvwxyz +;api_password = abcdefghijklmnopqrstuvwxyz +; +;[example.com] +;hostname = @ +;type = A +; +;[foo.bar] +;hostname = @ +;type = A diff --git a/src/netcup_dns/main.py b/src/netcup_dns/main.py index 96429dd..553a3f8 100644 --- a/src/netcup_dns/main.py +++ b/src/netcup_dns/main.py @@ -26,6 +26,10 @@ def main(): for cfg_file in cfg_files: cfg = configparser.ConfigParser() cfg.read(cfg_file) + if len(cfg.sections()) == 0: + # Skip completely empty configuration file. + continue + customer = cfg['credentials']['customer'] api_key = cfg['credentials']['api_key'] api_password = cfg['credentials']['api_password']