Skip to main content

Environment Variables

Scanner uses environment variables for two purposes:

  1. System configuration — set in your .env file (read by Docker Compose)
  2. AI provider API keys — managed via the Scanner UI and stored encrypted per-target

System Configuration

Set these in your root .env file before starting Scanner.

Required

VariableDescription
SECRET_KEY_BASESecret key for sessions and encryption. Generate with openssl rand -hex 64.
POSTGRES_PASSWORDPostgreSQL database password.

Network & Port

VariableDefaultDescription
PORT80Host port Scanner is accessible on. Change if port 80 is unavailable.
ASSUME_SSLfalseSet to true when running behind a TLS-terminating proxy.
SESSION_COOKIE_DOMAINRequired when ACTION_CABLE_URL uses a different subdomain (e.g., .scanner.example.com).
ACTION_CABLE_URLWebSocket URL when WebSockets are on a different host (e.g., wss://ws.scanner.example.com/cable).

Database

VariableDefaultDescription
POSTGRES_USERscannerDatabase username.
POSTGRES_HOSTpostgresHostname (only needed for external PostgreSQL).
POSTGRES_PORT5432Port number.
DATABASE_URLFull PostgreSQL URL. Overrides individual POSTGRES_* vars.

See Database Configuration for DATABASE_URL format and managed PostgreSQL setup.

Scanning Behavior

VariableDefaultDescription
EVALUATION_THRESHOLD0.2Controls vulnerability detection strictness. Lower = stricter.
RETENTION_DAYS90Days to keep reports before automatic deletion.

Logging

VariableDefaultDescription
RAILS_LOG_LEVELinfoLog verbosity: debug, info, warn, error.

Admin Seed Account

VariableDefaultDescription
ADMIN_EMAILadmin@example.comInitial admin email (used only on first boot).
ADMIN_INITIAL_PASSWORDpasswordInitial admin password (used only on first boot).

AI Provider API Keys (via UI)

API keys for AI providers are configured through the Scanner UI, not in .env. This keeps secrets scoped per-tenant and encrypted at rest.

How to Configure API Keys

  1. Log in to Scanner
  2. Navigate to Configuration → Environment Variables
  3. Click New Environment Variable
  4. Set:
    • Target — leave blank for global, or select a specific target
    • Name — the variable name (see table below)
    • Value — your API key

Supported API Key Variables

OpenAI

OpenRouter

Azure OpenAI

  • AZURE_API_KEY
  • AZURE_ENDPOINT — Your Azure resource endpoint URL
  • AZURE_MODEL_NAME — Deployment name

Anthropic

Groq

Replicate

Hugging Face

Cohere

Global vs. Target-Specific Variables

Global variables (no target selected) apply to all scans. Target-specific variables override globals for that target only.

Use target-specific keys to:

  • Use different credentials for production vs. test targets
  • Limit credential exposure if a key is compromised
  • Test the same model with different API plans

Priority: target-specific → global (target-specific always wins)

Evaluation Threshold Tuning

EnvironmentRecommended EVALUATION_THRESHOLD
Production (strict)0.10.15
Development / testing0.20.3
Initial exploration0.30.5