Environment variables
The backend reads its configuration from environment variables. Compose supplies them through .env; native Linux uses /etc/usage-dashboard/backend.env; a standalone container receives them from its container manager. Values with a default are optional.
Core
| Variable | Description |
|---|---|
DATABASE_URL | Async SQLAlchemy URL. Compose derives a PostgreSQL URL when this is blank. Native and standalone deployments must set a postgresql+asyncpg:// URL. The application default SQLite URL is for development only. |
ENCRYPTION_KEY | Required Fernet key used to encrypt API credentials at rest. Generate with python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())". |
Database (Compose)
| Variable | Description |
|---|---|
POSTGRES_DB | PostgreSQL database name. Defaults to usage_dashboard. |
POSTGRES_USER | PostgreSQL user. Defaults to usage_dashboard. |
POSTGRES_PASSWORD | PostgreSQL password. Defaults to change-me (change it). |
POSTGRES_IMAGE | PostgreSQL image used by Compose. Defaults to postgres:18-alpine. Opt in to postgres:19-alpine only for a fresh cluster or after the database upgrade. Keep the existing major for application-only updates. Both use the /var/lib/postgresql mount. |
Authentication
| Variable | Description |
|---|---|
ADMIN_SESSION_EXPIRE_HOURS | Hours before password-login session tokens expire. Defaults to 24. |
ADMIN_RECOVERY_CODE_EXPIRE_MINUTES | Minutes before setup/reset codes printed in backend logs expire. Defaults to 30. |
API access
| Variable | Description |
|---|---|
BACKEND_CORS_ORIGINS | Comma-separated allowed origins for the FastAPI API. |
HOMEPAGE_ALLOWED_HOSTS | Comma-separated hostnames that may access GET /api/v1/homepage without a bearer token; ports are ignored. All other API routes still require a valid admin session or scoped API token. |
CUSTOM_HTTP_ALLOWED_HOSTS | Comma-separated hostnames the Custom HTTP provider is allowed to reach. Blank allows any host. |
Images and networking
| Variable | Description |
|---|---|
IMAGE_TAG | Tag for both default GHCR application images. Defaults to the recommended stable latest (stable is equivalent); main is development, vX.Y.Z is immutable, and vX.Y/vX are moving stable aliases. Pulls and deployments are always operator-initiated. |
BACKEND_IMAGE | Optional full backend image override. Defaults to ghcr.io/skulldorom/usage-dashboard-backend:${IMAGE_TAG}. |
FRONTEND_IMAGE | Optional full frontend image override. Defaults to ghcr.io/skulldorom/usage-dashboard-frontend:${IMAGE_TAG}. |
NGINX_HTTP_PORT | Host port published by the frontend/proxy container. Defaults to 3000. |
VITE_API_BASE_URL | Frontend build-time API base path. Published images use /api; this is not a runtime container or Compose override. |
Polling and retention
| Variable | Description |
|---|---|
AUTO_POLL_ENABLED | Enables background provider polling. Defaults to true. |
AUTO_POLL_INTERVAL_MINUTES | Minutes between automatic provider polls. Defaults to 60. |
SNAPSHOT_RETENTION_DAYS | Days of raw usage snapshots to retain. Defaults to 180. |
ANALYTICS_HOURLY_RETENTION_DAYS | Days of normalized hourly analytics observations to retain. Defaults to 365. Daily aggregates are kept indefinitely once materialized. |
REQUEST_TIMEOUT_SECONDS | Seconds before an upstream provider request times out. Defaults to 20. |
Application version metadata
| Variable | Description |
|---|---|
APP_VERSION | Actual backend build version, exposed through auth-status metadata. Official images embed it during the build; native builds load generated deploy/version.env. Defaults to unknown. Do not override it to imitate a release. |
VITE_APP_VERSION | Frontend build-time version embedded in the JS bundle. Must match the running backend before a notification can appear. Official/native release builds set it automatically. |
Release checking has no backend configuration or GitHub token. The former UPDATE_CACHE_SECONDS and UPDATE_REQUEST_TIMEOUT_SECONDS settings are removed.
When upgrading from a release that used backend release checking, remove these obsolete variables from Compose .env and any backend environment overrides, /etc/usage-dashboard/backend.env on native Linux, or the backend container's environment in Portainer or another container manager. For Compose, inspect only the relevant variables with docker compose exec backend printenv UPDATE_CACHE_SECONDS UPDATE_REQUEST_TIMEOUT_SECONDS (the command may exit nonzero when a variable is absent). Recreate the backend container or restart the native backend service after updating its configuration. These variables no longer affect update notifications; do not replace an old six-hour value with a five-minute override. After upgrading both application artifacts, verify update checks in the authenticated dashboard's browser network panel: on load or tab visibility, an uncached check requests GitHub directly, not the removed /api/v1/updates endpoint. A valid cached result can suppress a new request until its 15-minute lifetime expires.
Browser cache (15 minutes), failure backoff (one minute), and timeout (five seconds) are defined in the frontend service. See update notifications.
Browser extension targets
| Variable | Description |
|---|---|
EXTENSION_TARGET_CHROME_ID | Optional runtime Chrome extension ID used by one-click setup. |
EXTENSION_TARGET_EDGE_ID | Optional runtime Edge extension ID. |
EXTENSION_TARGET_OPERA_ID | Optional runtime Opera extension ID. |
EXTENSION_TARGET_FIREFOX_ID | Optional runtime Firefox extension ID. |
EXTENSION_TARGET_SAFARI_ID | Optional runtime Safari extension ID. |
These override the published extension IDs at runtime (loaded through /runtime-config.js), which is useful for testing unpacked/dev builds without rebuilding the GHCR image. See Browser Extension for details.