Update 'README.md'

main
Brett 2023-03-16 14:22:06 -04:00
parent a039f26262
commit afceed8d19
1 changed files with 15 additions and 4 deletions

View File

@ -4,7 +4,15 @@ General useful scripts (mostly for Linux)
# dns_fetch.py
---
This lovely python script allows you to fetch ip address form cloudflare dns records. Useful for remote servers with dynamic ips. You can define the env file "dns_resolv_env.json" as follows:
This lovely python script allows you to fetch ip address form cloudflare dns records. This is useful for remote servers with dynamic ips you wish to keep private. Pretty nifty eh?
## Env file
---
The script searches for a file named `dns_resolv_env.json` in:
- your home directory (`~/`)
- the config folder (`~/.local/share/dns_helper/`)
- the local folder (`./`)
- the parent folder (`../`)
The file is a json file with 3 possible attributes
```
{
"auth_key": "key here",
@ -14,10 +22,13 @@ This lovely python script allows you to fetch ip address form cloudflare dns rec
```
### Notes
---
- The env file itself is optional but the script will require you to pass your auth key with `--auth "key here"`
- The env file and its arguments are optional.
- If no auth key is specified, the script will require you to pass your auth key with `--auth "key here"`
- Zone id can be provided via the commandline arg `--zone` or in the env file.
- If no zone id is provided the script will fetch and print from ALL zones on your cloudflare account.
- If default_name is not specified by either file or via `-n "name"`, filtering will be ignored
### Usage Examples
- If default_name is not specified by either file or via `-n "name"`, filtering will be ignored.
- Commandline args are always prefered.
## Usage Examples
---
- `python3 dns_fetch.py -a -n -i`
- Returns only the ip address of the A record corresponding to default_name.