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>
This commit is contained in:
root 2026-05-12 05:17:58 +00:00
parent 08a617a94e
commit 53db0c7847

View File

@ -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)