Spaces:
Sleeping
Sleeping
|
Download README.md from DeepThoughtAI/prolog_gateway: direct link, hf CLI and curl.
- Browser
- Download file 2.67 kB
-
https://huggingface.co/spaces/DeepThoughtAI/prolog_gateway/resolve/main/README.md
- Command line
-
hf download hf://spaces/DeepThoughtAI/prolog_gateway/README.md
-
curl -L -o README.md https://huggingface.co/spaces/DeepThoughtAI/prolog_gateway/resolve/main/README.md
2.67 kB
metadata
title: Prolog Gateway
emoji: 📊
colorFrom: blue
colorTo: pink
sdk: docker
pinned: false
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Authentication
The gateway uses JWT for authenticated access to proxy endpoints.
Multi-user login
User credentials are stored and managed in the private backend. The public gateway proxies login/registration requests to the backend and issues JWTs to the frontend.
Configure one or more initial users via environment variables on the backend Space:
APP_USERS_JSON: JSON object mappingusername -> plaintext_password(recommended for demos; store as secrets)APP_USERS_HASHED_JSON: JSON object mappingusername -> werkzeug_password_hash(recommended for production)APP_USER/APP_PASSWORD: legacy single-user plaintext credentials (still supported)TEST_USER_PASSWORD: if set, enables atest_useraccount with this password
Persistence:
- The backend stores users in a SQLite database (passwords are hashed).
- Configure the DB file path on the backend with
USER_DB_PATH(use a persistent mount such as/data/users.dbif available).
Seeding behavior (backend):
- On startup, the backend seeds users from
APP_USERS_JSON,APP_USERS_HASHED_JSON,APP_USER/APP_PASSWORD, andTEST_USER_PASSWORD. - Seeding does not overwrite existing passwords; it only adds missing users and updates admin flags.
Examples:
APP_USERS_JSON={"alice":"pw1","bob":"pw2","test_user":"pw3"}TEST_USER_PASSWORD=changeme(creates usertest_user)
Notes:
- Do not hardcode passwords in the repo. Use Hugging Face Space secrets or your deployment secret store.
- The JWT identity is set to the username.
Admin-only user registration
The gateway can create users at runtime via POST /register.
- Requires a valid JWT (
Authorization: Bearer ...). - Only allowed if the JWT identity (username) is in
ADMIN_USERS.
Env vars (backend):
ADMIN_USERS: comma-separated usernames who can call/register(e.g.ADMIN_USERS=alice,bob)- If
ADMIN_USERSis not set butAPP_USERis set,APP_USERis treated as the admin for convenience.
- If
Request body:
{ "username": "new_user", "password": "pw", "overwrite": false }
Notes:
- Users created via
/registerare stored in the backend SQLite DB atUSER_DB_PATH(persist across restarts).
Current user info
GET /me (JWT required) returns the current username and whether the user is an admin:
{ "ok": true, "username": "alice", "is_admin": true }
- Used by the frontend to show the “Register User” panel only for admins.