Skip to content

Commit

Permalink
Allow turning on --verbose mode by environment variable $DEBUG
Browse files Browse the repository at this point in the history
- Run application by an entrypoint.sh script to allow more debug options
  • Loading branch information
ssiuhk committed Feb 18, 2021
1 parent fdc1312 commit 05d23aa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
7 changes: 2 additions & 5 deletions docker/ddns/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM golang:alpine

RUN apk add --no-cache git

COPY docker/ddns/entrypoint.sh /entrypoint.sh
WORKDIR /go/src/github.com/pboehm/ddns
COPY . .

Expand All @@ -11,8 +12,4 @@ RUN GO111MODULE=on go install -v ./...
ENV GIN_MODE release
ENV DDNS_EXPIRATION_DAYS 10

CMD /go/bin/ddns \
--domain=${DDNS_DOMAIN} \
--soa_fqdn=${DDNS_SOA_DOMAIN} \
--redis=${DDNS_REDIS_HOST} \
--expiration-days=${DDNS_EXPIRATION_DAYS}
ENTRYPOINT ["/entrypoint.sh"]
22 changes: 22 additions & 0 deletions docker/ddns/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

if [[ $# -eq 0 ]]; then

if [[ "${DEBUG_MODE:-false}" == "true" ]]; then
/go/bin/ddns \
--domain=${DDNS_DOMAIN} \
--soa_fqdn=${DDNS_SOA_DOMAIN} \
--redis=${DDNS_REDIS_HOST} \
--expiration-days=${DDNS_EXPIRATION_DAYS} \
--verbose
else
/go/bin/ddns \
--domain=${DDNS_DOMAIN} \
--soa_fqdn=${DDNS_SOA_DOMAIN} \
--redis=${DDNS_REDIS_HOST} \
--expiration-days=${DDNS_EXPIRATION_DAYS}
fi

else
"$@"
fi
1 change: 1 addition & 0 deletions docker/docker-compose.override.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
DDNS_DOMAIN: d.example.net # <<< ADJUST DOMAIN
DDNS_SOA_DOMAIN: ddns.example.net # <<< ADJUST DOMAIN
DDNS_EXPIRATION_DAYS: 10
DEBUG_MODE: "false"

powerdns:
ports:
Expand Down

0 comments on commit 05d23aa

Please sign in to comment.