token managed with gopass

main
Ricard Illa 2022-09-14 19:00:12 +02:00
parent c0f27f89a3
commit 57da1f9f3f
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ DOMAIN_ID = $(STATE_DIR)/domain_id.txt
RECORD_ID = $(STATE_DIR)/record_id.txt RECORD_ID = $(STATE_DIR)/record_id.txt
UPDATE_RECORD = $(STATE_DIR)/updated_record UPDATE_RECORD = $(STATE_DIR)/updated_record
LINODE_TOKEN = $(shell cat /mnt/secrets/linode_token) LINODE_TOKEN = $(shell gopass linode.com/token)
CURL = curl --silent CURL = curl --silent
AUTH_CURL = $(CURL) -H "Authorization: Bearer $(LINODE_TOKEN)" AUTH_CURL = $(CURL) -H "Authorization: Bearer $(LINODE_TOKEN)"
@ -27,7 +27,7 @@ endef
# to update the record when that happens # to update the record when that happens
$(UPDATE_RECORD): $(HOST_IP) $(DOMAIN_ID) $(RECORD_ID) $(UPDATE_RECORD): $(HOST_IP) $(DOMAIN_ID) $(RECORD_ID)
@echo "updating record" @echo "updating record"
$(AUTH_CURL) \ @$(AUTH_CURL) \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-X PUT -d '{ "target": "'"$$(cat $<)"'" }' \ -X PUT -d '{ "target": "'"$$(cat $<)"'" }' \
"$(API_URL)/domains/$$(cat $(DOMAIN_ID))/records/$$(cat $(RECORD_ID))" "$(API_URL)/domains/$$(cat $(DOMAIN_ID))/records/$$(cat $(RECORD_ID))"