Configuration¶
Ospobox follows the 12-factor app methodology and is configured primarily through environment variables.
Configuration Methods¶
Configuration can be provided via:
- Environment variables (highest priority)
.envfile in the project root- 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 |
ALLOW_REGISTRATION |
true |
Whether anyone reaching the site can create an account |
The first user¶
With ALLOW_REGISTRATION=true, which is the default, the first person to
reach /auth/register creates their own account and becomes its owner.
That is the hosted shape.
An instance on an intranet usually wants the opposite: no one who can
reach the site should be able to grant themselves an account. Set
ALLOW_REGISTRATION=false and create the first owner from a shell on the
server:
ospobox create-admin --email you@example.com
# Created owner you@example.com
# Password: <generated, printed once>
Pass --password to choose one, or set HOP3_ADMIN_PASSWORD in the
environment. A password given either way is not echoed, since it is
already known to whoever ran the command and the output usually lands in
a deploy log.
The command is idempotent, so it is also how a locked-out owner gets back
in: run it again on the same address and that user's password is reset,
with their account, organizations and reports untouched. It promotes a
member to owner, which is the way out of an account whose only owner
is gone. ospobox show-admin --email you@example.com exits non-zero when
there is no such owner.
With registration closed, /auth/register returns 404 and the API
endpoint refuses with 400. Additional users are added by the owner.
Production Secret Key
Never use the default secret key in production. Generate a secure one:
Database¶
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
sqlite+aiosqlite:///./data/ospobox.db |
Database connection URL |
DATABASE_ECHO |
false |
Log all SQL queries (verbose) |
Redis¶
| Variable | Default | Description |
|---|---|---|
REDIS_URL |
redis://localhost:6379 |
Connection URL for the job queue and rate limiting |
The background worker runs its queue on Redis, so an instance without one never syncs, scores or sends. Rate limiting uses Redis where it is reachable and falls back to an in-memory window where it is not, which is per-process and so counts wrongly across several workers.
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
Connecting a platform¶
Ospobox reads public data with no credential at all. To see private repositories, or to have it list the organizations you already belong to, it needs one of two things.
An access token, which needs nothing configured here¶
Anyone signed in can paste a personal access token under Settings > Connected platforms, or at /onboarding, for any of the four platforms. The token is checked against the platform before it is stored, encrypted at rest, and never rendered back into a page.
This is the only way to connect Codeberg or SourceHut: neither has an OAuth flow in Ospobox.
Create a token with read access to your repositories and organizations:
| Platform | Where | Narrowest that works |
|---|---|---|
| GitHub | Settings > Developer settings > Personal access tokens | No scopes at all for public repositories. repo for private ones, read:org to list your organizations |
| GitLab | Preferences > Access tokens | read_api |
| Codeberg | Settings > Applications > Generate token | Read access to repositories, issues and organizations |
| SourceHut | meta.sr.ht > Personal access tokens | git.sr.ht/PROFILE:RO git.sr.ht/REPOSITORIES:RO git.sr.ht/OBJECTS:RO |
SourceHut tokens are account-wide
Leaving the grants field empty grants full read and write access to every sr.ht service. Always fill it in. The string above is read-only and limited to git.sr.ht.
sr.ht grants cannot be limited to public repositories. Its scopes
are PROFILE, REPOSITORIES, OBJECTS and ACLS, each read-only
or read-write, per service. There is no public-only scope. A read
grant reads every repository that account can see, including private
ones.
A token is required even for public data: git.sr.ht answers 401 to
any unauthenticated query, so there is no anonymous mode to fall back
on.
If you want a credential that genuinely cannot reach your private work, make a second, empty sr.ht account and use its token. It is not on your private repositories' access list, so the question does not arise.
Ospobox only ever reads. No adapter sends a write of any kind, and the
SourceHut adapter's GraphQL documents are five queries and no mutations.
Encryption at rest protects the database file; it does not protect
against someone who can read both the database and SECRET_KEY.
An OAuth application, which the operator registers once¶
OAuth gives a one-click Connect button instead, and works for GitHub and GitLab. The registration belongs to the deployment rather than to a person: a hosted Ospobox registers one application and every account uses it, while each self-hosted install registers its own, because the callback URL names one host.
Registering nothing is a supported way to run Ospobox. The wizard says so, and offers the token form instead.
GitHub¶
To enable GitHub integration:
- Create a GitHub OAuth App at github.com/settings/developers
- Set the callback URL to
{BASE_URL}/api/v1/oauth/github/callback - Configure the credentials:
GitLab¶
To enable GitLab integration:
- Create a GitLab application at your GitLab instance settings
- Set the callback URL to
{BASE_URL}/api/v1/oauth/gitlab/callback - Configure the credentials:
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 on purpose:
| Setting | Default | Description |
|---|---|---|
WEBHOOK_ALLOW_PRIVATE_TARGETS |
false |
Allow delivery to localhost and private IP ranges. |
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_BRIEFING_MAX_TOKENS |
4000 |
The same, for a briefing, which runs to several repositories of prose. |
LLM_PROVIDER |
openai |
Provider hint (informational; only the API shape is used). |
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; the feature never blocks report generation.
Subscriptions and quotas¶
One switch decides whether this instance sells plans. With STRIPE_SECRET_KEY empty the instance has no tiers and nothing to enforce: every quota check allows before it reads the database. The billing routes answer 404 to anything that probes them. That is the self-hosted default. Set the key and the limits in vision.md's pricing table start being enforced.
| Variable | Default | Description |
|---|---|---|
STRIPE_SECRET_KEY |
(empty) | The switch as well as the credential. Empty means an unlimited instance. |
STRIPE_WEBHOOK_SECRET |
(empty) | Signing secret for the webhook. Nothing is trusted while this is unset. |
STRIPE_PRICE_TEAM |
(empty) | Price id checkout uses for the Team tier. |
STRIPE_PRICE_BUSINESS |
(empty) | Price id checkout uses for the Business tier. |
Three endpoints appear under /api/v1/billing when the switch is on: POST /checkout/{tier} opens a hosted Stripe page, GET /plan reports the tier and the usage against each limit, and POST /webhook receives subscription events. Settings shows the same plan surface in the dashboard, reading the count the quota check reads.
The webhook signature is the whole boundary
The webhook is the only unauthenticated write in the API, because Stripe has no token to send. Anyone who can post a payload it accepts can promote their own account. It therefore verifies the bytes it received before reading them, and refuses a payload older than Stripe's five-minute tolerance. During a secret rotation it accepts any of the several signatures sent, and while STRIPE_WEBHOOK_SECRET is unset it trusts no one.
What each tier allows¶
| Tier | Repositories | Organizations | External organizations | Private repositories |
|---|---|---|---|---|
| Free | 5 | 1 | No | No |
| Team | 50 | Unlimited | No | Yes |
| Business | 200 | Unlimited | Yes | Yes |
| Enterprise | Unlimited | Unlimited | Yes | Yes |
Organization counts above Free read "scales with tier" in the pricing table and name no number, so they stay unlimited here. An unknown tier string falls back to Free, because the column is plain text and a typo in it must not grant an Enterprise allowance. A request that a plan does not cover is answered 402, with a message naming the limit it hit.
Advisory sources¶
OSV is queried with no configuration at all. VulnerableCode is an optional second provider beside it; a public instance needs a key, and a self-hosted one needs the URL.
| Variable | Default | Description |
|---|---|---|
VULNERABLECODE_URL |
(empty) | Base URL of a VulnerableCode instance. |
VULNERABLECODE_API_KEY |
(empty) | API key for a public instance. |
Either value enables the provider. Advisory data has its own license: VulnerableCode's is CC-BY-SA-4.0, so anything you redistribute from it needs attribution and the same license.
Behind a reverse proxy¶
| Variable | Default | Description |
|---|---|---|
TRUST_PROXY_HEADERS |
false |
Read the client address from X-Forwarded-For. |
Turn this on only where a proxy you control sets the header and strips any the client sent. The login throttle and the per-endpoint rate limits are keyed on the client address, so a caller who can set the header sets their own limit. Leave it off and every request behind the proxy shares one address instead, which throttles them as a group.
Error Tracking (Sentry)¶
Sentry is opt-in: set SENTRY_DSN to enable it. When the variable is 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:
# 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_KEYis the default value - Warns if
SECRET_KEYis less than 32 characters - Warns if
JWT_ACCESS_TOKEN_EXPIRATIONis greater than 1 hour
- Raises error if
-
Development (
DEBUG=true):- Suggests setting longer token expiration for convenience
Next Steps¶
- First steps - Start monitoring organizations
- API Authentication - API authentication details