Spaces:
Sleeping
Sleeping
| set -euo pipefail | |
| # Allow Google Drive MCP credentials to be supplied as env var JSON content. | |
| # This is an alternative to volume-mounting the files (useful for cloud deployments). | |
| if [ -n "${GOOGLE_DRIVE_OAUTH_KEYS_JSON:-}" ]; then | |
| echo "$GOOGLE_DRIVE_OAUTH_KEYS_JSON" > /tmp/gcp-oauth.keys.json | |
| chmod 600 /tmp/gcp-oauth.keys.json | |
| export GOOGLE_DRIVE_OAUTH_CREDENTIALS=/tmp/gcp-oauth.keys.json | |
| fi | |
| if [ -n "${GOOGLE_DRIVE_TOKENS_JSON:-}" ]; then | |
| echo "$GOOGLE_DRIVE_TOKENS_JSON" > /tmp/google-drive-mcp-tokens.json | |
| chmod 600 /tmp/google-drive-mcp-tokens.json | |
| export GOOGLE_DRIVE_MCP_TOKEN_PATH=/tmp/google-drive-mcp-tokens.json | |
| fi | |
| # Start Google Drive MCP server in background, forwarding its output to stdout/stderr | |
| google-drive-mcp start --transport http --port 3100 --host 127.0.0.1 > >(tee -a /var/log/google-drive-mcp.log >&1) 2> >(tee -a /var/log/google-drive-mcp.log >&2) & | |
| echo "Google Drive MCP server started (PID $!)" | |
| # Start FastAPI app in foreground | |
| exec uv run uvicorn app.api:app --host 0.0.0.0 --port 7860 | |