Skip to main content

Environment Variables

Complete reference for Batchivo configuration.

Required Variables

VariableDescriptionExample
SECRET_KEYJWT signing key (64+ chars)openssl rand -base64 64
DATABASE_URLPostgreSQL connection stringpostgresql+psycopg://user:pass@host:5432/db

Optional Variables

Application

VariableDescriptionDefault
ENVIRONMENTEnvironment namedevelopment
DEBUGEnable debug modefalse
LOG_LEVELLogging levelINFO

Database

VariableDescriptionDefault
DATABASE_URLDatabase connectionRequired
DATABASE_POOL_SIZEConnection pool size5
DATABASE_MAX_OVERFLOWMax overflow connections10

Redis (Optional)

VariableDescriptionDefault
REDIS_URLRedis connection stringredis://localhost:6379/0

CORS

VariableDescriptionDefault
CORS_ORIGINSAllowed origins (JSON array)["http://localhost:5173"]
CORS_ALLOW_CREDENTIALSAllow credentialstrue

Authentication

VariableDescriptionDefault
SECRET_KEYJWT signing keyRequired
ACCESS_TOKEN_EXPIRE_MINUTESAccess token lifetime30
REFRESH_TOKEN_EXPIRE_DAYSRefresh token lifetime7

Observability

VariableDescriptionDefault
ENABLE_TRACINGEnable OpenTelemetry tracingfalse
ENABLE_METRICSEnable Prometheus metricsfalse
OTEL_EXPORTER_OTLP_ENDPOINTOTLP collector endpoint-

Storage

VariableDescriptionDefault
STORAGE_TYPEStorage backend (local or s3)local
STORAGE_PATHLocal storage path./uploads
S3_BUCKETS3 bucket name-
S3_REGIONS3 region-

Generating Secret Key

# Python
python -c "import secrets; print(secrets.token_urlsafe(64))"

# OpenSSL
openssl rand -base64 64

Example .env File

# Required
SECRET_KEY=your-secure-secret-key-here
DATABASE_URL=postgresql+psycopg://batchivo:password@localhost:5432/batchivo

# Optional
ENVIRONMENT=production
LOG_LEVEL=INFO
CORS_ORIGINS=["https://batchivo.example.com"]

# Redis (if using)
REDIS_URL=redis://localhost:6379/0

# Observability (if using)
ENABLE_TRACING=true
ENABLE_METRICS=true
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317

Docker Compose Environment

Set variables in your shell before running docker-compose:

export SECRET_KEY=$(python -c "import secrets; print(secrets.token_urlsafe(64))")
export DB_PASSWORD=$(openssl rand -base64 32)

docker-compose up -d

Or use a .env file in the same directory as docker-compose.yml:

SECRET_KEY=your-key
DB_PASSWORD=your-password