docs: expand configuration docs for admin and BadgerDB

Update README to explain startup config precedence (defaults/env/admin overrides),
document admin/bootstrap and feature toggles, and clarify storage locations under
WARPBOX_DATA_DIR including BadgerDB metadata. Also refresh project layout to
include new config and metastore packages.docs: expand configuration docs for admin and BadgerDB

Update README to explain startup config precedence (defaults/env/admin overrides),
document admin/bootstrap and feature toggles, and clarify storage locations under
WARPBOX_DATA_DIR including BadgerDB metadata. Also refresh project layout to
include new config and metastore packages.
This commit is contained in:
2026-04-28 21:11:37 +03:00
parent fc3de58b5b
commit a5d6d69be0
27 changed files with 3499 additions and 97 deletions

View File

@@ -86,13 +86,45 @@ Tuning is done with:
## Configuration
Runtime configuration is intentionally small.
Runtime configuration is centralized in `lib/config`. Startup applies built-in
defaults, environment variables, then safe BadgerDB settings overrides.
| Variable | Default | Purpose |
| --- | ---: | --- |
| `WARPBOX_BOX_POLL_INTERVAL_MS` | `5000` | Status polling interval used by box pages. |
| `WARPBOX_THUMBNAIL_BATCH_SIZE` | `10` | Number of thumbnail jobs per worker pass. |
| `WARPBOX_THUMBNAIL_INTERVAL_SECONDS` | `30` | Delay between thumbnail worker passes. |
Storage paths are derived from `WARPBOX_DATA_DIR`:
```text
<WARPBOX_DATA_DIR>/uploads
<WARPBOX_DATA_DIR>/db
```
The admin account is bootstrapped from `WARPBOX_ADMIN_PASSWORD` when no admin
user exists. If the password is empty, admin login stays disabled unless an
admin user already exists in BadgerDB.
Primary environment variables:
- `WARPBOX_DATA_DIR`
- `WARPBOX_ADMIN_PASSWORD`
- `WARPBOX_ADMIN_USERNAME`
- `WARPBOX_ADMIN_EMAIL`
- `WARPBOX_ADMIN_ENABLED`
- `WARPBOX_ALLOW_ADMIN_SETTINGS_OVERRIDE`
- `WARPBOX_ADMIN_COOKIE_SECURE`
- `WARPBOX_GUEST_UPLOADS_ENABLED`
- `WARPBOX_API_ENABLED`
- `WARPBOX_ZIP_DOWNLOADS_ENABLED`
- `WARPBOX_ONE_TIME_DOWNLOADS_ENABLED`
- `WARPBOX_RENEW_ON_ACCESS_ENABLED`
- `WARPBOX_RENEW_ON_DOWNLOAD_ENABLED`
- `WARPBOX_DEFAULT_GUEST_EXPIRY_SECONDS`
- `WARPBOX_MAX_GUEST_EXPIRY_SECONDS`
- `WARPBOX_GLOBAL_MAX_FILE_SIZE_BYTES`
- `WARPBOX_GLOBAL_MAX_BOX_SIZE_BYTES`
- `WARPBOX_DEFAULT_USER_MAX_FILE_SIZE_BYTES`
- `WARPBOX_DEFAULT_USER_MAX_BOX_SIZE_BYTES`
- `WARPBOX_SESSION_TTL_SECONDS`
- `WARPBOX_BOX_POLL_INTERVAL_MS`
- `WARPBOX_THUMBNAIL_BATCH_SIZE`
- `WARPBOX_THUMBNAIL_INTERVAL_SECONDS`
The HTTP listen address is configured through the CLI flag:
@@ -106,10 +138,13 @@ go run ./cmd run --addr :8080
cmd/main.go CLI setup
lib/server/server.go Gin engine setup and worker startup
lib/server/handlers.go HTTP handlers
lib/server/admin.go Admin handlers
lib/routing/routes.go Route table
lib/boxstore/store.go Box manifests, uploads, downloads, retention
lib/boxstore/thumbnails.go
Thumbnail scanning and generation
lib/config/config.go Typed config and settings definitions
lib/metastore/ BadgerDB metadata store
lib/models/models.go Shared data structures
```