#!/bin/sh -eu
# SPDX-License-Identifier: WTFPL

if [ -z "${FXRELAY_TOKEN-}" ]
then
	echo '$FXRELAY_TOKEN must be set' >&2
	exit 1
fi

curl -f -S -s https://relay.firefox.com/api/v1/relayaddresses/ \
	-m 60 \
	-H "Authorization: Token $FXRELAY_TOKEN" \
	-H "content-type: application/json" \
	-d "{\"enabled\": true, \"block_list_emails\": false, \"description\": \"${1-}\"}"
