Download entrypoint.sh from a3216/ds2api: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/entrypoint.sh
- Command line
-
hf download hf://spaces/a3216/ds2api@ce5a019598af8a3a8fa70d3880098df3e850ecd7/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/a3216/ds2api/resolve/ce5a019598af8a3a8fa70d3880098df3e850ecd7/entrypoint.sh
1 kB
| set -e | |
| # Fix /data permissions for HF Spaces Persistent Storage | |
| if [ -d /data ]; then | |
| chown -R ds2api:ds2api /data 2>/dev/null || true | |
| fi | |
| # Create config file if not exists or is empty (with empty JSON object) | |
| if [ ! -f /data/config.json ] || [ ! -s /data/config.json ]; then | |
| echo {} > /data/config.json | |
| fi | |
| # Always ensure config.json is writable by ds2api user, even if the file | |
| # was created by a previous container with different ownership (common on | |
| # HuggingFace Spaces persistent storage after rebuild). | |
| chown ds2api:ds2api /data/config.json 2>/dev/null || true | |
| chmod 600 /data/config.json 2>/dev/null || true | |
| # Create chat history file if not exists or is empty | |
| if [ ! -f /data/chat_history.json ] || [ ! -s /data/chat_history.json ]; then | |
| echo {} > /data/chat_history.json | |
| fi | |
| chown ds2api:ds2api /data/chat_history.json 2>/dev/null || true | |
| chmod 644 /data/chat_history.json 2>/dev/null || true | |
| # Start the application as ds2api user | |
| exec gosu ds2api /usr/local/bin/ds2api | |