Overview
Bitwarden Server services can be configured using environment variables. Environment variables override settings fromappsettings.json files.
Environment variable names use double underscores (
__) to represent nested configuration sections.Example: globalSettings__sqlServer__connectionStringVariable Naming Convention
Configuration path to environment variable conversion:appsettings.json
Core Configuration
Global Settings
boolean
default:"false"
Enable self-hosted mode. Disables cloud-specific features.
string
default:"Bitwarden"
Display name for the installation.
string
required
Service name (Api, Identity, Admin, etc.).
Database Configuration
string
required
Primary database connection string.SQL Server:PostgreSQL:MySQL:
string
Optional read replica connection string for read operations.
string
default:"sqlserver"
Database provider:
sqlserver, postgres, or mysql.Certificate Configuration
string
SHA-1 thumbprint of Identity Server signing certificate.
string
Path to Identity Server certificate PFX file (alternative to thumbprint).
string
Password for Identity Server certificate PFX file.
string
SHA-1 thumbprint of Data Protection certificate.
Storage Configuration
string
required
Blob storage connection string for attachments.Azure Blob Storage:Local Development (Azurite):
string
Separate storage for attachments (optional).
string
Separate storage for Send files (optional).
Mail Configuration
string
required
Reply-to email address for system emails.
string
SendGrid API key for email delivery.
string
SMTP server hostname.
integer
default:"587"
SMTP server port.
boolean
default:"true"
Enable SSL/TLS for SMTP.
string
SMTP authentication username.
string
SMTP authentication password.
Service URLs
string
required
Public URL for API service.
string
required
Public URL for Identity service.
string
Public URL for Admin service.
string
Public URL for Notifications service.
string
Public URL for SSO service.
string
required
Public URL for web vault.
Message Bus Configuration
string
Azure Service Bus or RabbitMQ connection string.Azure Service Bus:RabbitMQ:
boolean
default:"false"
Use RabbitMQ instead of Azure Service Bus.
Cache Configuration
string
Redis connection string for distributed caching.
string
default:"memory"
Cache provider:
memory, redis, or cosmos.Service-Specific Variables
API Service
boolean
default:"true"
Enable rate limiting.
string
default:"X-Forwarded-For"
Header containing real client IP (when behind proxy).
Identity Service
string
Override issuer URI for tokens.
Notifications Service
string
Azure Notification Hub connection string.
string
Azure Notification Hub name.
SSO Service
integer
default:"5"
SSO configuration cache lifetime.
ASP.NET Core Variables
string
default:"Production"
Runtime environment:
Development, Staging, or Production.string
default:"http://+:5000"
URLs to listen on.
string
Path to Kestrel HTTPS certificate.
string
Password for Kestrel HTTPS certificate.
Logging Configuration
string
default:"Information"
Default log level:
Trace, Debug, Information, Warning, Error, Critical.string
default:"Warning"
Log level for Microsoft libraries.
Docker Compose Example
Complete example with all common variables:docker-compose.yml
Environment File
Store variables in.env file:
.env
Validation
Test configuration after setting environment variables:Security Best Practices
Use Secrets Management
Store sensitive values in:
- Docker secrets
- Kubernetes secrets
- Azure Key Vault
- HashiCorp Vault
- AWS Secrets Manager
Restrict Access
- Limit who can view environment variables
- Use read-only volumes for certificates
- Rotate credentials regularly
Audit Logging
- Log configuration changes
- Monitor secret access
- Alert on configuration errors
Validation
- Validate on startup
- Use strong passwords
- Test in staging first
Next Steps
Configuration
Learn about appsettings.json configuration
Docker Deployment
Deploy with Docker Compose
SSL Certificates
Configure certificates
Troubleshooting
Resolve configuration issues