From a59413c021c4bd101a74afe1756f6482553843d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sat, 22 Nov 2025 16:04:20 +0100 Subject: [PATCH] fix: check multiple locations for .env file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Try PROJECT_ROOT/ai/.env first - Fallback to PROJECT_ROOT/.env - Fallback to /workspace/ai/.env - Fixes HF_TOKEN loading on RunPod 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- artifact_comfyui_download.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/artifact_comfyui_download.sh b/artifact_comfyui_download.sh index 5c16f9b..1010441 100755 --- a/artifact_comfyui_download.sh +++ b/artifact_comfyui_download.sh @@ -107,9 +107,16 @@ COMFYUI_DIR="${COMFYUI_DIR:-${HOME}/ComfyUI/models}" COMMAND="both" # HuggingFace token from environment or .env file -if [[ -f "${PROJECT_ROOT}/.env" ]]; then +# Try multiple locations for .env file +if [[ -z "${HF_TOKEN}" ]] && [[ -f "${PROJECT_ROOT}/ai/.env" ]]; then + HF_TOKEN=$(grep ^HF_TOKEN "${PROJECT_ROOT}/ai/.env" | cut -d'=' -f2- | tr -d '"' | tr -d "'" || true) +fi +if [[ -z "${HF_TOKEN}" ]] && [[ -f "${PROJECT_ROOT}/.env" ]]; then HF_TOKEN=$(grep ^HF_TOKEN "${PROJECT_ROOT}/.env" | cut -d'=' -f2- | tr -d '"' | tr -d "'" || true) fi +if [[ -z "${HF_TOKEN}" ]] && [[ -f "/workspace/ai/.env" ]]; then + HF_TOKEN=$(grep ^HF_TOKEN "/workspace/ai/.env" | cut -d'=' -f2- | tr -d '"' | tr -d "'" || true) +fi HF_TOKEN="${HF_TOKEN:-}" # ============================================================================