Browse Source

Allow PDNS_HOST to be a URL

tags/v0.4.0
Silke 1 year ago
parent
commit
5059ef29e6
2 changed files with 8 additions and 3 deletions
  1. +1
    -1
      README.md
  2. +7
    -2
      pdns_api.sh

+ 1
- 1
README.md View File

@@ -8,7 +8,7 @@ Add the settings for your PowerDNS API to Dehydrated's `config`
or a `config` file next to `pdns_api.sh`:

```sh
PDNS_HOST=ns0.example.com
PDNS_HOST=ns0.example.com # API Host. Can also be a URL, eg: http://ns0.example.com:8081
PDNS_PORT=8081 # Optional. Defaults to 8081
PDNS_KEY=secret # API key
PDNS_SERVER=localhost # Optional. Server for the API to use, usually `localhost`

+ 7
- 2
pdns_api.sh View File

@@ -150,8 +150,13 @@ setup() {
# Header with the api key
headers="X-API-Key: ${PDNS_KEY}"

# Add the host and port to the url
url="http://${PDNS_HOST}:${PDNS_PORT}"
# Set the URL to the host if it is a URL,
# otherwise create it from the host and port.
if [[ "${PDNS_HOST}" == http?(s)://* ]]; then
url="${PDNS_HOST}"
else
url="http://${PDNS_HOST}:${PDNS_PORT}"
fi

# Detect the version
if [[ -z "${PDNS_VERSION:-}" ]]; then

Loading…
Cancel
Save