cache secrets to file, fix spinner animation

This commit is contained in:
2026-03-16 22:06:47 -04:00
parent 423de9c9e8
commit a45813db35
2 changed files with 34 additions and 20 deletions
+7 -5
View File
@@ -28,10 +28,14 @@ if ! command -v bw &>/dev/null; then
exit 1
fi
# --- Get secrets (cached in env vars, or fetch from Bitwarden) ---
# --- Get secrets (cached in file, or fetch from Bitwarden) ---
if [ -n "${HANTIM_GITEA_TOKEN:-}" ]; then
echo "Using cached secrets from environment."
SECRETS_CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/hantim-secrets"
if [ -f "$SECRETS_CACHE" ]; then
echo "Using cached secrets."
# shellcheck source=/dev/null
source "$SECRETS_CACHE"
GITEA_TOKEN="$HANTIM_GITEA_TOKEN"
else
if bw status 2>/dev/null | grep -q '"status":"unauthenticated"'; then
@@ -46,8 +50,6 @@ else
bw sync --session "${BW_SESSION:-}"
GITEA_TOKEN=$(bw get notes hantim-new-app-script --session "${BW_SESSION:-}")
export HANTIM_GITEA_TOKEN="$GITEA_TOKEN"
fi
# --- Delete Gitea repo ---