Add new tools to interract with admin api

This commit is contained in:
nemunaire 2021-01-10 16:56:04 +01:00
parent 1ab421757b
commit 0dcf620429
3 changed files with 19 additions and 2 deletions

View File

@ -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
COPY --from=gobuild /go/src/git.happydns.org/happydns/happydns /usr/sbin/happydns
COPY hadmin.sh /usr/bin/hadmin

View File

@ -8,4 +8,5 @@ ENV HAPPYDNS_LEVELDB_PATH=/data/happydns.db
VOLUME /data
COPY happydns /usr/sbin/happydns
COPY happydns /usr/sbin/happydns
COPY hadmin.sh /usr/bin/hadmin

15
hadmin.sh Executable file
View File

@ -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