Replaces the single per-user DRF token with named, individually-revocable
API keys, so you can run one key per agent and cut off a leaked one without
disrupting the others.
- New ApiKey model (user, name, dbk_-prefixed key, created_at, last_used_at).
Data migration copies every existing authtoken 1:1 into a "default" named
key with the same value, so no client (incl. the sibling test project's
hardcoded test-user key) needs reconfiguring.
- Auth (resolve_token_user) resolves against ApiKey and stamps last_used_at,
throttled to one write/minute.
- Settings -> API Keys: table with name/key/created/last-used + per-row
revoke and a create form; keys viewable on demand. Settings -> Account now
links here; Settings -> Users issues a named initial key.
- Gated provisioning API for test installations: GET/POST /api/keys and
DELETE /api/keys/{id}, controlled by DAYBOOK_KEY_PROVISIONING_API (unset ->
follows DEBUG, so off in deployment). Advertised via key_provisioning_api
in /api/capabilities; 403 when disabled.
- Docs (api/deployment/quickstart/posting-helper), SKILL.md, and env.example
updated from "token / Settings -> Account" to "key / Settings -> API Keys".
- Tests: new API + UI suites for keys; existing token-based tests moved to
ApiKey. Full suite 129 passing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
1.5 KiB
Text
26 lines
1.5 KiB
Text
DJANGO_DEBUG=0
|
|
DJANGO_SECRET_KEY=replace-with-a-long-random-secret
|
|
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,your-vm-ip,your-domain.example
|
|
# Required if Daybook sits behind a TLS-terminating reverse proxy (Apache,
|
|
# Nginx, Traefik, a cloud load balancer). Without it, login/POST fails with
|
|
# "CSRF verification failed" because Django can't tell the original request
|
|
# was HTTPS. Set to the public HTTPS origin(s) users actually visit:
|
|
DJANGO_CSRF_TRUSTED_ORIGINS=https://your-domain.example
|
|
# Leave OFF in deployment. When on, POST /api/keys can create/list/revoke API
|
|
# keys over the network (it returns key material), which is only appropriate
|
|
# for automated test installations. Unset, it follows DJANGO_DEBUG — so with
|
|
# DJANGO_DEBUG=0 above it is already off. Set to 1 only on a throwaway test box.
|
|
# DAYBOOK_KEY_PROVISIONING_API=0
|
|
DAYBOOK_DATA_DIR=/data
|
|
DATABASE_PATH=/data/db.sqlite3
|
|
ARTIFACTS_ROOT=/data/artifacts_store
|
|
|
|
# Optional, read by deploy/docker-compose.yml directly (not by the app):
|
|
# DAYBOOK_BIND_ADDR=127.0.0.1
|
|
# Uncomment and set to 127.0.0.1 when a reverse proxy on the same host will
|
|
# front this service — this stops the container port from being reachable
|
|
# directly from the network. Leave unset (binds all interfaces) only for
|
|
# private/VPN-only deployments with no proxy in front.
|
|
# DAYBOOK_HOST_DATA_DIR=/mnt/some-larger-volume/daybook-data
|
|
# Uncomment and point at a path on a separate/larger volume if the host's
|
|
# main disk is space-constrained. Defaults to ./data next to this file.
|