Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve HF_TOKEN Safety and Messaging #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions deploy/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash

function clean_token() {
local raw_token="$1"
echo "${raw_token//[^a-zA-Z0-9]/}" # Removing characters that are not alphanumeric
}

if [[ ! -z "${HF_TOKEN}" ]]; then
echo "The HF_TOKEN environment variable is set, logging to Hugging Face."
python3 -c "import huggingface_hub; huggingface_hub.login('${HF_TOKEN}')"
safe_token=$(clean_token "${HF_TOKEN}")
echo "The HF_TOKEN environment variable is set, logging to Hugging Face with sanitized token."
python3 -c "import huggingface_hub; huggingface_hub.login('${safe_token}')"
else
echo "The HF_TOKEN environment variable is not set or empty, not logging to Hugging Face."
fi

# Run the provided command
exec python3 -u -m vllm.entrypoints.openai.api_server "$@"