From afceed8d191d2791867cbd33b3c16244da6fe5c9 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 16 Mar 2023 14:22:06 -0400 Subject: [PATCH] Update 'README.md' --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8d4b25a..3188694 100644 --- a/README.md +++ b/README.md @@ -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.