Skip to content

Configuration

Ospobox follows the 12-factor app methodology and is configured primarily through environment variables.

Configuration Methods

Configuration can be provided via:

  1. Environment variables (highest priority)
  2. .env file in the project root
  3. Default values in code

Core Settings

Application

Variable Default Description
APP_NAME Ospobox Application name shown in UI
DEBUG false Enable debug mode (development only)
SECRET_KEY change-me-in-production Secret key for signing tokens
BASE_URL http://localhost:8000 Base URL for the application

Production Secret Key

Never use the default secret key in production. Generate a secure one:

python -c "import secrets; print(secrets.token_urlsafe(32))"

Database

Variable Default Description
DATABASE_URL sqlite+aiosqlite:///./data/ospobox.db Database connection URL
DATABASE_ECHO false Log all SQL queries (verbose)
DATABASE_URL=sqlite+aiosqlite:///./ospobox.db
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/ospobox

Redis (Optional)

Variable Default Description
REDIS_URL None Redis connection URL for caching
REDIS_URL=redis://localhost:6379/0

JWT Authentication

Configure token expiration times:

Variable Default Description
JWT_ACCESS_TOKEN_EXPIRATION 1h Access token lifetime
JWT_REFRESH_TOKEN_EXPIRE_DAYS 30 Refresh token lifetime in days

Duration Format

The JWT_ACCESS_TOKEN_EXPIRATION setting uses a human-readable format:

Unit Example Description
s 30s Seconds
m 30m Minutes
h 1h Hours
d 7d Days
w 1w Weeks
y 1y Years (365 days)
# Production (recommended)
JWT_ACCESS_TOKEN_EXPIRATION=1h

# Development (convenient)
JWT_ACCESS_TOKEN_EXPIRATION=7d

OAuth Integration

GitHub

To enable GitHub integration:

  1. Create a GitHub OAuth App at github.com/settings/developers
  2. Set the callback URL to {BASE_URL}/api/oauth/github/callback
  3. Configure the credentials:
GITHUB_CLIENT_ID=your-client-id
GITHUB_CLIENT_SECRET=your-client-secret

GitLab

To enable GitLab integration:

  1. Create a GitLab application at your GitLab instance settings
  2. Set the callback URL to {BASE_URL}/api/oauth/gitlab/callback
  3. Configure the credentials:
GITLAB_CLIENT_ID=your-client-id
GITLAB_CLIENT_SECRET=your-client-secret

Email Settings

Configure SMTP for sending reports and notifications:

Variable Default Description
SMTP_HOST (empty) SMTP server hostname
SMTP_PORT 587 SMTP server port
SMTP_USERNAME (empty) SMTP username
SMTP_PASSWORD (empty) SMTP password
SMTP_USE_TLS true Enable TLS encryption
EMAIL_FROM_ADDRESS noreply@ospobox.io Sender email address
EMAIL_FROM_NAME Ospobox Sender display name
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USERNAME=apikey
SMTP_PASSWORD=your-api-key
SMTP_USE_TLS=true
EMAIL_FROM_ADDRESS=reports@your-domain.com
EMAIL_FROM_NAME=Ospobox Reports

Webhook Delivery Targets

Webhook URLs pointing at localhost or private network ranges are rejected, because a delivery target the operator did not intend is an SSRF hole. Self-hosted deployments whose actuators live on an internal network turn that guard off deliberately:

Setting Default Description
WEBHOOK_ALLOW_PRIVATE_TARGETS false Allow delivery to localhost and private IP ranges.
# Only when the delivery targets are on a network you control
WEBHOOK_ALLOW_PRIVATE_TARGETS=true

It lifts the network guard and nothing else: the scheme and URL-shape checks still apply.

AI Summaries (LLM)

Ospobox can attach an AI-generated executive summary to each activity report. The integration is optional and opt-in: when no API key is set the feature is silently disabled and no calls are made.

The client targets any OpenAI-compatible chat completions endpoint, so you can use OpenAI, Anthropic via a compatible proxy, DeepSeek, Together, vLLM, Ollama, and others without code changes.

Variable Default Description
LLM_API_KEY (empty) API key. Empty disables the feature.
LLM_API_BASE https://api.openai.com/v1 Base URL of the chat completions API.
LLM_MODEL gpt-4o-mini Model identifier.
LLM_TIMEOUT 30 HTTP timeout in seconds.
LLM_MAX_TOKENS 500 Maximum tokens for the summary response.
LLM_PROVIDER openai Provider hint (informational; only the API shape is used).
OpenAI
LLM_API_KEY=sk-...
LLM_MODEL=gpt-4o-mini
Local Ollama
LLM_API_KEY=ollama  # any non-empty value
LLM_API_BASE=http://localhost:11434/v1
LLM_MODEL=llama3.1:8b

Summaries are populated automatically when reports are generated, and can be regenerated on demand from the report detail page. If the LLM call fails (timeout, rate limit, bad response) the report is still saved without a summary, and the feature never blocks report generation.

Error Tracking (Sentry)

Sentry integration is opt-in via SENTRY_DSN. When unset the SDK is not initialized.

Variable Default Description
SENTRY_DSN (empty) Sentry project DSN. Empty disables Sentry.
SENTRY_ENVIRONMENT development Environment tag (e.g. production, staging).
SENTRY_RELEASE (empty) Release identifier (e.g. ospobox@0.1.0).
SENTRY_TRACES_SAMPLE_RATE 0.0 Performance traces sample rate (0.0–1.0).
SENTRY_DSN=https://your-key@sentry.io/your-project-id
SENTRY_ENVIRONMENT=production
SENTRY_RELEASE=ospobox@0.1.0
SENTRY_TRACES_SAMPLE_RATE=0.1

Both the web app and SAQ workers initialize Sentry independently on startup. PII is not sent by default.

Example Configuration

Here's a complete .env file for production:

.env
# Application
APP_NAME=Ospobox
DEBUG=false
SECRET_KEY=your-secure-secret-key-here
BASE_URL=https://ospobox.your-domain.com

# Database
DATABASE_URL=postgresql+asyncpg://ospobox:password@localhost:5432/ospobox

# Redis
REDIS_URL=redis://localhost:6379/0

# JWT
JWT_ACCESS_TOKEN_EXPIRATION=1h
JWT_REFRESH_TOKEN_EXPIRE_DAYS=30

# GitHub OAuth
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret

# GitLab OAuth (optional)
# GITLAB_CLIENT_ID=your-gitlab-client-id
# GITLAB_CLIENT_SECRET=your-gitlab-client-secret

# Email
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USERNAME=apikey
SMTP_PASSWORD=your-sendgrid-api-key
SMTP_USE_TLS=true
EMAIL_FROM_ADDRESS=noreply@your-domain.com
EMAIL_FROM_NAME=Ospobox

Configuration Validation

Ospobox validates configuration on startup:

  • Production (DEBUG=false):

    • Raises error if SECRET_KEY is the default value
    • Warns if SECRET_KEY is less than 32 characters
    • Warns if JWT_ACCESS_TOKEN_EXPIRATION is greater than 1 hour
  • Development (DEBUG=true):

    • Suggests setting longer token expiration for convenience

Next Steps