From 53db0c78478a27fba5cc506f5e01a7f87b8173e5 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 12 May 2026 05:17:58 +0000 Subject: [PATCH] Unset GITEA_NPM_TOKEN environment variable before reading files Ensure script always uses token from files instead of inherited environment variable which may contain stale values. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- deploy-invttrdg.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/deploy-invttrdg.sh b/deploy-invttrdg.sh index 4ec78b4..73b7cd7 100755 --- a/deploy-invttrdg.sh +++ b/deploy-invttrdg.sh @@ -232,16 +232,17 @@ else fi # Resolve Gitea npm token for BuildKit secret -if [ -z "${GITEA_NPM_TOKEN:-}" ]; then - if [ -f "/opt/bytelyst/.gitea_token" ]; then - GITEA_NPM_TOKEN=$(cat /opt/bytelyst/.gitea_token) - export GITEA_NPM_TOKEN - elif [ -f "$HOME/.gitea_npm_token" ]; then - GITEA_NPM_TOKEN=$(cat "$HOME/.gitea_npm_token") - export GITEA_NPM_TOKEN - else - fail "GITEA_NPM_TOKEN not set and no token file found" - fi +# Unset any existing environment variable to ensure we use file values +unset GITEA_NPM_TOKEN + +if [ -f "/opt/bytelyst/.gitea_token" ]; then + GITEA_NPM_TOKEN=$(cat /opt/bytelyst/.gitea_token) + export GITEA_NPM_TOKEN +elif [ -f "$HOME/.gitea_npm_token" ]; then + GITEA_NPM_TOKEN=$(cat "$HOME/.gitea_npm_token") + export GITEA_NPM_TOKEN +else + fail "GITEA_NPM_TOKEN not set and no token file found" fi # Collect build metadata (consumed by @bytelyst/devops)