#!/bin/bash # Convert 'username/space-name' to 'username-space-name.hf.space' HF_DOMAIN=$(echo $SPACE_ID | sed 's/\//-/g').hf.space echo "Setting up Puter for: $HF_DOMAIN" # Create the config directory mkdir -p /etc/puter # Generate the config file Puter needs to bypass the Host Header error cat < /etc/puter/config.json { "http_port": 7860, "domain": "$HF_DOMAIN", "experimental_no_subdomain": true, "allow_nipio_domains": true } EOF # Start Puter from its official location cd /opt/puter/app exec node index.js