2023-06-11 11:16:54 +02:00
|
|
|
all: build
|
|
|
|
|
2023-06-15 20:14:27 +02:00
|
|
|
# For requests where authentication is required.
|
|
|
|
LOGIN ?=
|
|
|
|
ifeq ($(LOGIN),)
|
|
|
|
LOGIN_OPT =
|
|
|
|
else
|
|
|
|
LOGIN_OPT = -l $(LOGIN)
|
|
|
|
endif
|
2023-05-08 21:42:05 +02:00
|
|
|
|
|
|
|
# No idea why, but I need that to run applications. Ignore that.
|
2023-06-27 20:31:02 +02:00
|
|
|
#LD_P ?= LD_PRELOAD=/usr/local/lib/libipc.so.0
|
|
|
|
|
|
|
|
Q ?= @
|
2023-05-08 21:42:05 +02:00
|
|
|
|
2024-03-12 21:51:59 +01:00
|
|
|
SHOULD_UPDATE = ./bin/should-update
|
|
|
|
|
2023-06-15 20:14:27 +02:00
|
|
|
####################
|
|
|
|
### REQUEST EXAMPLES
|
|
|
|
####################
|
2023-05-08 21:42:05 +02:00
|
|
|
|
2023-06-15 20:14:27 +02:00
|
|
|
DOMAIN ?= example.com
|
2023-06-28 02:26:12 +02:00
|
|
|
build-write-zone-file: tools/write-zone-file.cr
|
|
|
|
$(Q)-([ ! -f bin/write-zone-file ] || [ tools/write-zone-file.cr -nt bin/write-zone-file ]) && shards build write-zone-file
|
|
|
|
zone-file: build-write-zone-file
|
|
|
|
$(Q)./bin/write-zone-file $(DOMAIN)
|
|
|
|
|
|
|
|
build-write-template-zone-file: tools/write-template-zone-file.cr
|
|
|
|
$(Q)-([ ! -f bin/write-template-zone-file ] || [ tools/write-template-zone-file.cr -nt bin/write-template-zone-file ]) && shards build write-template-zone-file
|
|
|
|
zone-basic-template-file: build-write-template-zone-file
|
|
|
|
$(Q)./bin/write-template-zone-file $(DOMAIN)
|
2023-05-08 21:42:05 +02:00
|
|
|
|
|
|
|
VERBOSITY ?= 4
|
|
|
|
run-client-verbosity:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client admin maintenance verbosity $(VERBOSITY) $(LOGIN_OPT)
|
2023-05-08 21:42:05 +02:00
|
|
|
|
2023-06-27 13:00:26 +02:00
|
|
|
run-client-domain-add:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user domain add $(DOMAIN) $(LOGIN_OPT)
|
2023-06-27 13:00:26 +02:00
|
|
|
|
|
|
|
run-client-domain-del:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user domain del $(DOMAIN) $(LOGIN_OPT)
|
2023-06-27 13:00:26 +02:00
|
|
|
|
2023-06-27 13:06:05 +02:00
|
|
|
run-client-domain-list:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user domain list $(LOGIN_OPT)
|
2023-06-27 13:06:05 +02:00
|
|
|
|
2023-05-08 21:42:05 +02:00
|
|
|
run-client-zone-add:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user zone add $(DOMAIN).json $(LOGIN_OPT)
|
2023-05-08 21:42:05 +02:00
|
|
|
|
2023-06-27 13:06:05 +02:00
|
|
|
run-client-zone-get:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user zone get $(DOMAIN) $(LOGIN_OPT)
|
2023-06-27 13:06:05 +02:00
|
|
|
|
2023-05-08 21:42:05 +02:00
|
|
|
RRID ?= 1
|
|
|
|
NAME ?=
|
|
|
|
TTL ?= 3600
|
|
|
|
TARGET ?=
|
|
|
|
run-client-rr-add-a:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user rr add A $(DOMAIN) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
2023-06-16 00:06:14 +02:00
|
|
|
|
2023-05-08 21:42:05 +02:00
|
|
|
run-client-rr-update-a:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user rr update A $(DOMAIN) $(RRID) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
2023-05-08 21:42:05 +02:00
|
|
|
|
|
|
|
run-client-rr-del:
|
2023-06-27 20:31:02 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanager-client user rr del $(DOMAIN) $(RRID) $(LOGIN_OPT)
|
2023-05-08 21:42:05 +02:00
|
|
|
|
2023-06-15 20:14:27 +02:00
|
|
|
##################
|
|
|
|
### SETUP COMMANDS
|
|
|
|
##################
|
2023-05-08 21:42:05 +02:00
|
|
|
|
2023-07-07 20:23:06 +02:00
|
|
|
DBDIR=/tmp/DATA-dnsmanagerd
|
2023-05-08 21:42:05 +02:00
|
|
|
run-dnsmanagerd:
|
2023-07-07 20:23:06 +02:00
|
|
|
$(Q)$(LD_P) ./bin/dnsmanagerd -v $(VERBOSITY) -r $(DBDIR)
|
2023-06-15 20:14:27 +02:00
|
|
|
|
2024-03-14 23:11:51 +01:00
|
|
|
PORT ?= 8082
|
|
|
|
ADDR ?=
|
|
|
|
run-token-handler:
|
|
|
|
$(Q)$(LD_P) ./bin/token-handler $(PORT) $(ADDR)
|
|
|
|
|
2023-06-15 20:14:27 +02:00
|
|
|
build-server:
|
2024-03-12 21:51:59 +01:00
|
|
|
$(Q)-$(SHOULD_UPDATE) bin/dnsmanagerd && shards build dnsmanagerd
|
2023-06-15 20:14:27 +02:00
|
|
|
|
|
|
|
build-client:
|
2024-03-12 21:51:59 +01:00
|
|
|
$(Q)-$(SHOULD_UPDATE) bin/dnsmanager-client && shards build dnsmanager-client
|
|
|
|
|
|
|
|
build-token-handler:
|
2024-03-14 04:44:09 +01:00
|
|
|
$(Q)shards build token-handler
|
2023-06-15 20:14:27 +02:00
|
|
|
|
2024-03-12 21:51:59 +01:00
|
|
|
build: build-server build-client build-token-handler
|
2023-06-15 13:06:55 +02:00
|
|
|
|
|
|
|
print-messages:
|
|
|
|
cat src/requests/*.cr | ./bin/get-messages.awk
|
|
|
|
print-message-numbers:
|
|
|
|
make -s print-messages | grep -E "^[0-9]" | sort -n
|
|
|
|
print-messages-without-comments:
|
|
|
|
make -s print-messages | grep -vE '^[[:blank:]]+#'
|
|
|
|
print-response-messages:
|
|
|
|
cat src/responses/*.cr | ./bin/get-messages.awk
|
|
|
|
print-response-message-numbers:
|
|
|
|
make -s print-response-messages | grep -E "^[0-9]" | sort -n
|
|
|
|
print-response-messages-without-comments:
|
|
|
|
make -s print-response-messages | grep -vE '^[[:blank:]]+#'
|
2023-07-07 20:23:06 +02:00
|
|
|
|
|
|
|
rm-db:
|
|
|
|
rm -r $(DBDIR)
|