dev: add tea + agenix; optional agenix tokens
This commit is contained in:
parent
b16a26c014
commit
810556aa99
5 changed files with 84 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ cd "${root}"
|
|||
# Prefer setting env vars directly in CI (`CLOUDFLARE_API_TOKEN`).
|
||||
token_file="${EVERY_CHANNEL_CF_TOKEN_FILE:-}"
|
||||
account_file="${EVERY_CHANNEL_CF_ACCOUNT_FILE:-}"
|
||||
agenix_secret="${EVERY_CHANNEL_CF_TOKEN_AGE_SECRET:-secrets/cloudflare-api-token.age}"
|
||||
|
||||
if [[ -z "${CLOUDFLARE_API_TOKEN:-}" && -n "${token_file}" && -f "${token_file}" ]]; then
|
||||
export CLOUDFLARE_API_TOKEN
|
||||
|
|
@ -19,6 +20,11 @@ if [[ -z "${CLOUDFLARE_ACCOUNT_ID:-}" && -n "${account_file}" && -f "${account_f
|
|||
CLOUDFLARE_ACCOUNT_ID="$(cat "${account_file}")"
|
||||
fi
|
||||
|
||||
if [[ -z "${CLOUDFLARE_API_TOKEN:-}" && -f "${agenix_secret}" && -x "$(command -v agenix)" ]]; then
|
||||
export CLOUDFLARE_API_TOKEN
|
||||
CLOUDFLARE_API_TOKEN="$(agenix -d "${agenix_secret}")"
|
||||
fi
|
||||
|
||||
if [[ -z "${CLOUDFLARE_API_TOKEN:-}" ]]; then
|
||||
echo "error: CLOUDFLARE_API_TOKEN is not set" >&2
|
||||
exit 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue