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
27
scripts/tea-login-codeberg.sh
Executable file
27
scripts/tea-login-codeberg.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "${root}"
|
||||
|
||||
# Forgejo CLI: `tea` (Gitea-compatible)
|
||||
#
|
||||
# Auth token source order:
|
||||
# 1) CODEBERG_TOKEN env var
|
||||
# 2) `agenix -d secrets/codeberg-token.age` (optional)
|
||||
|
||||
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)"
|
||||
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
|
||||
|
||||
# Name the login "codeberg" and point at https://codeberg.org.
|
||||
tea login add --name codeberg --url https://codeberg.org --token "${CODEBERG_TOKEN}" --insecure=false
|
||||
echo "tea configured. Try: tea repo ls"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue