| --- |
| title: DS2API |
| emoji: π |
| colorFrom: blue |
| colorTo: indigo |
| sdk: docker |
| app_port: 5001 |
| pinned: false |
| --- |
| |
| # DS2API Docker Space |
|
|
| This Space packages the `ds2api` Linux amd64 binary from the uploaded Docker/OCI image so it can run on Hugging Face Spaces with the Docker SDK. |
|
|
| ## Required Space settings |
|
|
| For a public Space, do **not** commit real credentials into `config.json`. Put them in **Settings β Variables and secrets** instead. |
|
|
| Recommended secrets: |
|
|
| - `DS2API_ADMIN_KEY`: admin panel password/key. Use a strong random value. |
| - `DS2API_CONFIG_JSON`: full JSON config. Start from `config.example.json`, replace `keys` and `accounts`, then paste the whole JSON as a secret. |
|
|
| Optional variables: |
|
|
| - `PORT`: defaults to `5001`. The Space metadata sets `app_port: 5001`, so you normally do not need to change it. |
| - `DS2API_STATIC_ADMIN_DIR`: defaults to `/app/static/admin`. |
| - `DS2API_CONFIG_PATH`: use this only if you mount or commit a config file yourself. |
|
|
| ## Local test |
|
|
| ```bash |
| docker build -t ds2api-space . |
| docker run --rm -p 5001:5001 \ |
| -e DS2API_ADMIN_KEY='change-me' \ |
| -e DS2API_CONFIG_JSON='{"keys":["your-api-key"],"accounts":[{"email":"you@example.com","password":"password"}]}' \ |
| ds2api-space |
| ``` |
|
|
| Then open: |
|
|
| - API health: `/healthz` |
| - Admin UI: `/admin` |
|
|
| ## Notes |
|
|
| If `DS2API_CONFIG_JSON` and `DS2API_CONFIG_PATH` are both missing, the container copies `config.example.json` into `/tmp/config.json` so the Space can boot, but real API calls will not work until you provide real config. |
|
|