diff --git a/Dockerfile b/Dockerfile index cf119bd..167ccac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,4 +46,5 @@ ENV HAPPYDNS_LEVELDB_PATH=/data/happydns.db VOLUME /data -COPY --from=gobuild /go/src/git.happydns.org/happydns/happydns /usr/sbin/happydns \ No newline at end of file +COPY --from=gobuild /go/src/git.happydns.org/happydns/happydns /usr/sbin/happydns +COPY hadmin.sh /usr/bin/hadmin diff --git a/Dockerfile-builded b/Dockerfile-builded index 200a433..ae9d09f 100644 --- a/Dockerfile-builded +++ b/Dockerfile-builded @@ -8,4 +8,5 @@ ENV HAPPYDNS_LEVELDB_PATH=/data/happydns.db VOLUME /data -COPY happydns /usr/sbin/happydns \ No newline at end of file +COPY happydns /usr/sbin/happydns +COPY hadmin.sh /usr/bin/hadmin diff --git a/hadmin.sh b/hadmin.sh new file mode 100755 index 0000000..749d3ff --- /dev/null +++ b/hadmin.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +[ -z "${HAPPYDNS_SOCKET}" ] && + DEST="./happydns.sock" || + DEST="${HAPPYDNS_SOCKET}" + +[ -S "${DEST}" ] && DEST="--unix-socket $DEST http://localhost" + +RET=$(curl -s ${DEST}"$@") +CODE=$? + +echo "$RET" | jq . 2> /dev/null || + echo "$RET" + +exit $CODE