Skip to content

Commit bc25fa5

Browse files
Add more logging so I know it's working
1 parent b5a7d32 commit bc25fa5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

netlify-dns/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
version: 0.0.7
2+
version: 0.0.8
33
slug: netlify-dns
44
name: Netlify DNS
55
description: >-

netlify-dns/data/run.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ function updateNetlify() {
4444
local ZONE_ID=$CACHED_ZONE_ID
4545
fi
4646

47+
bashio::log.info "Got DNS zone ID of $ZONE_ID"
48+
4749
if [ -z $CACHED_RECORD_IP ]; then
4850
local DNS_RECORDS_RESPONSE=$(curl -s -w "%{http_code}" "$NETLIFY_API/dns_zones/$ZONE_ID/dns_records?access_token=$TOKEN" --header "Content-Type:application/json")
4951
local DNS_RECORDS_RESPONSE_CODE=${DNS_RECORDS_RESPONSE: -3}
@@ -65,6 +67,8 @@ function updateNetlify() {
6567
local RECORD_VALUE=$CACHED_RECORD_IP
6668
fi
6769

70+
bashio::log.info "Got current DNS record value of $RECORD_VALUE"
71+
6872
if [[ "$RECORD_VALUE" != "$EXTERNAL_IP" ]]; then
6973

7074
bashio::log.info "Current external IP is $EXTERNAL_IP, current $HOSTNAME value is $RECORD_VALUE"
@@ -95,12 +99,15 @@ function updateNetlify() {
9599
if [[ $CREATE_RESPONSE_CODE != 201 ]]; then
96100
bashio::log.info "Create response code: ${CREATE_RESPONSE_CODE}"
97101
bashio::log.info "Create response body: ${CREATE_RESPONSE_CONTENT}"
98-
bashio::exit.nok "There was a problem creating the new entry for $HOSTNAME on Netlift"
102+
bashio::exit.nok "There was a problem creating the new entry for $HOSTNAME on Netlify"
99103
fi
104+
105+
bashio::log.info "Updated $HOSTNAME to $EXTERNAL_IP"
100106
fi
101107
}
102108

103109
while true; do
110+
bashio::log.info "Running IP update"
104111
if bashio::config.has_value "ip"; then
105112
EXTERNAL_IP=$(bashio::config 'ip')
106113
if [[ ! $EXTERNAL_IP =~ $IPV4_PATTERN ]]; then
@@ -113,7 +120,5 @@ while true; do
113120

114121
updateNetlify
115122

116-
now="$(date +%s)"
117-
118123
sleep "${WAIT_TIME}"
119124
done

0 commit comments

Comments
 (0)