feat: mv example from README to .ini file

This commit is contained in:
Daniel Langbein 2023-03-28 17:26:51 +02:00
parent 9ac720ef31
commit 88596cbd46
3 changed files with 18 additions and 15 deletions

View File

@ -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

12
cfg/example.ini Normal file
View File

@ -0,0 +1,12 @@
;[credentials]
;customer = 123456
;api_key = abcdefghijklmnopqrstuvwxyz
;api_password = abcdefghijklmnopqrstuvwxyz
;
;[example.com]
;hostname = @
;type = A
;
;[foo.bar]
;hostname = @
;type = A

View File

@ -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']