ops: move to forgejo-primary hosting with mirror-only codeberg/github
This commit is contained in:
parent
a5bc6c5226
commit
043b1730dc
18 changed files with 336 additions and 66 deletions
|
|
@ -1,35 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Back-compat shim. Prefer `scripts/fj-auth-forge.sh`.
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${root}"
|
||||
|
||||
# Forgejo CLI: `fj`
|
||||
#
|
||||
# Auth token source order:
|
||||
# 1) CODEBERG_TOKEN env var
|
||||
# 2) `agenix -d secrets/codeberg-token.age` (optional)
|
||||
# 3) `age -d -i <identity> 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 ]]; then
|
||||
if command -v agenix >/dev/null 2>&1; then
|
||||
export CODEBERG_TOKEN
|
||||
CODEBERG_TOKEN="$(RULES="${rules_file}" agenix -d secrets/codeberg-token.age -i "${identity_file}")"
|
||||
elif command -v age >/dev/null 2>&1; then
|
||||
export CODEBERG_TOKEN
|
||||
CODEBERG_TOKEN="$(age -d -i "${identity_file}" secrets/codeberg-token.age)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${CODEBERG_TOKEN:-}" ]]; then
|
||||
echo "error: CODEBERG_TOKEN is not set" >&2
|
||||
echo "hint: set CODEBERG_TOKEN or create secrets/codeberg-token.age via agenix" >&2
|
||||
exit 2
|
||||
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"
|
||||
exec "${root}/scripts/fj-auth-forge.sh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue