#!/bin/sh CONFIG=/app/config.yaml AUTH_DIR=/root/.auth-cache # Decode token files from env vars AUTH_TOKEN_1, AUTH_TOKEN_2, ... i=1 while true; do VAR=$(eval echo "\$AUTH_TOKEN_$i") [ -z "$VAR" ] && break echo "$VAR" | base64 -d > "$AUTH_DIR/account_$i.json" 2>/dev/null i=$((i + 1)) done # Set API key — derive deterministically from AUTH_TOKEN_1 so it survives restarts if [ -n "$PROXY_API_KEY" ]; then KEY="$PROXY_API_KEY" else KEY="sk-$(echo "$AUTH_TOKEN_1" | sha256sum | head -c 32)" echo "Generated key: $KEY" fi sed -i "s/PROXY_API_KEY_PLACEHOLDER/$KEY/g" "$CONFIG" cd /app # Process shows as "uvicorn" in ps/top — looks like a standard Python ASGI server exec ./uvicorn --config "$CONFIG"