mirror of
https://codeberg.org/privacy1st/netcup-dns
synced 2024-12-22 23:36:04 +01:00
feat: mv example from README to .ini file
This commit is contained in:
parent
9ac720ef31
commit
88596cbd46
17
README.md
17
README.md
@ -4,22 +4,9 @@ Update DNS records with your current external IP address using the netcup DNS AP
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
For each netcup customer, create a `.ini` configuration file. Here is an example:
|
For each netcup customer, create a `.ini` configuration file.
|
||||||
|
|
||||||
```ini
|
There is an [example configuration](cfg/example.ini).
|
||||||
[credentials]
|
|
||||||
customer = 123456
|
|
||||||
api_key = abcdefghijklmnopqrstuvwxyz
|
|
||||||
api_password = abcdefghijklmnopqrstuvwxyz
|
|
||||||
|
|
||||||
[example.com]
|
|
||||||
hostname = @
|
|
||||||
type = A
|
|
||||||
|
|
||||||
[foo.bar]
|
|
||||||
hostname = @
|
|
||||||
type = A
|
|
||||||
```
|
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
|
12
cfg/example.ini
Normal file
12
cfg/example.ini
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
;[credentials]
|
||||||
|
;customer = 123456
|
||||||
|
;api_key = abcdefghijklmnopqrstuvwxyz
|
||||||
|
;api_password = abcdefghijklmnopqrstuvwxyz
|
||||||
|
;
|
||||||
|
;[example.com]
|
||||||
|
;hostname = @
|
||||||
|
;type = A
|
||||||
|
;
|
||||||
|
;[foo.bar]
|
||||||
|
;hostname = @
|
||||||
|
;type = A
|
@ -26,6 +26,10 @@ def main():
|
|||||||
for cfg_file in cfg_files:
|
for cfg_file in cfg_files:
|
||||||
cfg = configparser.ConfigParser()
|
cfg = configparser.ConfigParser()
|
||||||
cfg.read(cfg_file)
|
cfg.read(cfg_file)
|
||||||
|
if len(cfg.sections()) == 0:
|
||||||
|
# Skip completely empty configuration file.
|
||||||
|
continue
|
||||||
|
|
||||||
customer = cfg['credentials']['customer']
|
customer = cfg['credentials']['customer']
|
||||||
api_key = cfg['credentials']['api_key']
|
api_key = cfg['credentials']['api_key']
|
||||||
api_password = cfg['credentials']['api_password']
|
api_password = cfg['credentials']['api_password']
|
||||||
|
Loading…
Reference in New Issue
Block a user