Spaces:
Sleeping
Sleeping
| # Script to set up Firebase credentials secret on Hugging Face Spaces | |
| # Usage: ./scripts/setup_hf_secret.sh | |
| set -e | |
| SPACE_NAME="MCP-1st-Birthday/CuriousLearner" | |
| SECRET_NAME="FIREBASE_CREDENTIALS_JSON" | |
| CREDENTIALS_FILE="firebase-credentials.json" | |
| echo "π§ Setting up Firebase credentials secret on HF Spaces..." | |
| # Check if huggingface-cli is installed | |
| if ! command -v huggingface-cli &> /dev/null; then | |
| echo "β Error: huggingface-cli not found!" | |
| echo "Please install it: pip install huggingface-hub[cli]" | |
| exit 1 | |
| fi | |
| # Check if credentials file exists | |
| if [ ! -f "$CREDENTIALS_FILE" ]; then | |
| echo "β Error: $CREDENTIALS_FILE not found!" | |
| echo "Please ensure the credentials file exists in the current directory." | |
| exit 1 | |
| fi | |
| # Check if user is logged in | |
| if ! huggingface-cli whoami &> /dev/null; then | |
| echo "β Error: Not logged in to Hugging Face!" | |
| echo "Please run: huggingface-cli login" | |
| exit 1 | |
| fi | |
| # Read credentials file and set as secret | |
| echo "π€ Uploading secret to $SPACE_NAME..." | |
| CREDENTIALS_CONTENT=$(cat "$CREDENTIALS_FILE") | |
| # Use huggingface-cli to add secret | |
| huggingface-cli repo secret set "$SECRET_NAME" \ | |
| --repo "$SPACE_NAME" \ | |
| --repo-type space \ | |
| --value "$CREDENTIALS_CONTENT" | |
| echo "β Secret $SECRET_NAME successfully set on $SPACE_NAME!" | |
| echo "π Your HF Space will now have access to Firebase credentials." | |
| echo "" | |
| echo "β οΈ Note: You may need to restart the Space for changes to take effect." | |