fix: initialize HF_TOKEN before checking if empty

- Initialize HF_TOKEN="${HF_TOKEN:-}" before conditional checks
- Fixes "unbound variable" error with set -euo pipefail

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 16:05:12 +01:00
parent a59413c021
commit a52c5979a3

View File

@@ -107,6 +107,9 @@ COMFYUI_DIR="${COMFYUI_DIR:-${HOME}/ComfyUI/models}"
COMMAND="both"
# HuggingFace token from environment or .env file
# Initialize HF_TOKEN if not set
HF_TOKEN="${HF_TOKEN:-}"
# 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)
@@ -117,7 +120,6 @@ 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:-}"
# ============================================================================
# UTILITY FUNCTIONS - The Magic Happens Here