scripts: decrypt agenix secrets with explicit identity

This commit is contained in:
every.channel 2026-02-16 00:24:14 -05:00
parent 223272db7d
commit 4cd58a4bd7
No known key found for this signature in database
2 changed files with 7 additions and 3 deletions

View file

@ -10,9 +10,12 @@ cd "${root}"
# 1) CODEBERG_TOKEN env var
# 2) `agenix -d secrets/codeberg-token.age` (optional)
rules_file="${EVERY_CHANNEL_AGE_RULES_FILE:-./secrets.nix}"
identity_file="${EVERY_CHANNEL_AGE_IDENTITY_FILE:-$HOME/.config/every.channel/keys/founder_ed25519}"
if [[ -z "${CODEBERG_TOKEN:-}" && -f secrets/codeberg-token.age && -x "$(command -v agenix)" ]]; then
export CODEBERG_TOKEN
CODEBERG_TOKEN="$(agenix -d secrets/codeberg-token.age)"
CODEBERG_TOKEN="$(RULES="${rules_file}" agenix -d secrets/codeberg-token.age -i "${identity_file}")"
fi
if [[ -z "${CODEBERG_TOKEN:-}" ]]; then
@ -24,4 +27,3 @@ fi
# Avoid passing the token on the command line (shows up in process listings); use stdin.
printf "%s" "${CODEBERG_TOKEN}" | fj -H https://codeberg.org auth add-key every-channel
echo "fj configured. Try: fj -H https://codeberg.org whoami"