feat: merge user vars into a single config file

This commit is contained in:
Julian Lobbes 2022-09-02 22:55:34 +02:00
parent cf06da54e7
commit 32ce865607
5 changed files with 34 additions and 44 deletions

3
.gitignore vendored
View file

@ -1,5 +1,2 @@
.venv .venv
**/__pycache__ **/__pycache__
apikey.yml
domains.json

View file

@ -8,41 +8,35 @@ Python libraries:
- [requests](https://pypi.org/project/requests/) - [requests](https://pypi.org/project/requests/)
- [pyyaml](https://pypi.org/project/PyYAML/) - [pyyaml](https://pypi.org/project/PyYAML/)
### Initial setup ### Configuration
Install the [dependencies](#dependencies), preferrably using your system's package manager. Configuration is declared inside the file `config.yml`.
Once modified, this file **must be kept secret**, else anyone visiting your domains runs the risk of being DNS-poisoned.
Next, you will need your Ionos API keypair. First, you will need to set your Ionos API keypair in the config file.
Clone the repo and edit the file `apikey.yml`. Paste the respective values of your Ionos API-keypair into the file
Inside the file, paste the respective value of your Ionos API-keypair, following this format:
```yaml ```yaml
---
apikey: apikey:
prefix: <your api key prefix> prefix: <your api key prefix>
secret: <your api key secret> secret: <your api key secret>
...
``` ```
This file **must be kept secret**. Next, add every domain you wish to send an update for to the `domains` list.
The script will set a global DNS record for each listed domain and have it point to the local host's public IP address.
The `domains` list should have the following format:
### Adding target domains ```yaml
domains:
Add every domain you want to send an update for to the file `domains.json`. - example.com
The file should list each domain whose global DNS record should point to the local host's public IP. - subdomain1.example.com
The file must have the following format: - subdomain2.example.com
```json
{
"domains": [
"example.com",
"subdomain1.example.com",
"subdomain2.example.com",
],
"description": "My dynamic DNS."
}
``` ```
The description can have any string as a value, but it must be present. You may optionally set a descriptive string which is sent along with the update:
```yaml
description: "Dynamic DNS update."
```
As of right now, I am actually not sure what the description is needed for, but the API requires it.
The value displayed above is used by default, if you don't override it inside `config.yml`.

View file

@ -1,7 +0,0 @@
---
apikey:
prefix: <your api key prefix>
secret: <your api key secret>
...

14
config.yml Normal file
View file

@ -0,0 +1,14 @@
---
apikey:
prefix: <your api key prefix>
secret: <your api key secret>
domains:
- example.com
- subdomain1.example.com
- subdomain2.example.com
description: "Dynamic DNS update."
...

View file

@ -1,8 +0,0 @@
{
"domains": [
"example.com",
"subdomain1.example.com",
"subdomain2.example.com",
],
"description": "My dynamic DNS."
}