Skip to content

Configuration Reference

OpenCodeHub is configured via environment variables. Copy .env.example to .env and edit.

VariableDescriptionDefault
HOSTBind address0.0.0.0
PORTHTTP port4321
SITE_URLPublic URL of the instancehttp://localhost:4321
APP_NAMEInstance nameOpenCodeHub
NODE_ENVdevelopment or productiondevelopment
VariableDescriptionDefault
DATABASE_DRIVERpostgres, sqlite, or turso (LibSQL)postgres
DATABASE_URLConnection string
DATABASE_POOL_SIZEConnection pool size10
DATABASE_SSLEnable PostgreSQL SSLfalse
DATABASE_AUTH_TOKENAuth token (Turso/LibSQL only)
VariableDescriptionDefault
REDIS_URLRedis connection stringredis://localhost:6379
REDIS_PASSWORDRedis password

Redis is required in production for distributed locking, rate limiting, and sessions. For edge deployments (Vercel), use Upstash Redis with UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

VariableDescriptionGenerate With
JWT_SECRETSigns auth tokensopenssl rand -base64 32
JWT_EXPIRES_INToken expiry7d
SESSION_SECRETSigns session cookiesopenssl rand -base64 32

All secrets below must be unique. Generate each with openssl rand -hex 32.

VariablePurpose
INTERNAL_HOOK_SECRETSecures git hook communication between Git server and app
CRON_SECRETProtects cron endpoints (GC, mirror sync, notification digests)
AI_CONFIG_ENCRYPTION_KEYEncrypts AI provider API keys at rest
WORKFLOW_SECRET_ENCRYPTION_KEYEncrypts CI/CD workflow secrets at rest
RUNNER_SECRETShared secret between server and CI runners
VariableDescription
OAUTH_GOOGLE_CLIENT_IDGoogle OAuth client ID
OAUTH_GOOGLE_CLIENT_SECRETGoogle OAuth client secret
OAUTH_GITHUB_CLIENT_IDGitHub OAuth client ID
OAUTH_GITHUB_CLIENT_SECRETGitHub OAuth client secret
OAUTH_GITLAB_CLIENT_IDGitLab OAuth client ID
OAUTH_GITLAB_CLIENT_SECRETGitLab OAuth client secret

OpenCodeHub also supports SSO via SAML and OIDC. Configure these through the admin dashboard.

VariableDescriptionDefault
GIT_REPOS_PATHDirectory for git repositories./data/repositories
GIT_SSH_PORTSSH git server port2222
GIT_SSH_HOST_KEYPath to SSH host key./data/ssh/host_key
VariableDescriptionDefault
STORAGE_TYPElocal or s3local
STORAGE_PATHLocal storage path./data/storage

Works with AWS S3, MinIO, Cloudflare R2, Garage, SeaweedFS, Ceph RGW, Wasabi, Backblaze B2, and any S3-compatible service.

VariableDescription
STORAGE_BUCKETBucket name (required for S3)
STORAGE_REGIONS3 region (default: us-east-1)
STORAGE_ENDPOINTCustom S3 endpoint (for MinIO, R2, etc.)
STORAGE_ACCESS_KEY_IDS3 access key
STORAGE_SECRET_ACCESS_KEYS3 secret key
VariableDescriptionDefault
RUNNER_ENABLEDEnable the CI runnertrue
RUNNER_DOCKER_SOCKETDocker socket path/var/run/docker.sock
RUNNER_WORKSPACE_PATHWorkspace directory./data/runner/workspaces
RUNNER_ARTIFACTS_PATHArtifacts directory./data/runner/artifacts
RUNNER_CONCURRENT_JOBSMax concurrent jobs2
RUNNER_TIMEOUTJob timeout in seconds3600
RUNNER_REGISTRATION_TOKEN_TTL_DAYSToken TTL90
VariableDescriptionDefault
SMTP_HOSTSMTP hostname
SMTP_PORTSMTP port587
SMTP_USERSMTP username
SMTP_PASSWORDSMTP password
SMTP_FROMFrom addressnoreply@opencodehub.local
VariableDescriptionDefault
LOG_LEVELdebug, info, warn, errorinfo
LOG_FILELog file path./data/logs/opencodehub.log
VariableDescriptionDefault
RATE_LIMIT_ENABLEDEnable rate limitingtrue
RATE_LIMIT_AUTHAuth endpoints (req/15min)5
RATE_LIMIT_APIAPI endpoints (req/min)100
RATE_LIMIT_GITGit operations (req/min)200
RATE_LIMIT_GENERALGeneral endpoints (req/min)60
RATE_LIMIT_SKIP_DEVSkip in developmentfalse
CSRF_SKIP_DEVSkip CSRF in developmentfalse
VariableDescriptionDefault
ALLOWED_ORIGINSComma-separated allowed originshttp://localhost:4321
MAX_REQUEST_BODY_MBMax request body size (MB)10
MAX_PACK_SIZE_MBMax git pack size (MB)500
GIT_PROCESS_TIMEOUT_SECSGit process timeout (sec)300
VariableDescriptionDefault
ENABLE_REGISTRATIONAllow new user signupstrue
ENABLE_WIKIEnable repository wikistrue
ENABLE_ISSUESEnable issue trackingtrue
ENABLE_ACTIONSEnable CI/CD pipelinestrue
ENABLE_PACKAGESEnable package registryfalse
ENABLE_AI_ASSISTANTEnable AI code reviewtrue

Configure one or more AI providers for code review. Keys are encrypted at rest using AI_CONFIG_ENCRYPTION_KEY.

VariableProvider
OPENAI_API_KEYOpenAI (GPT-4, GPT-4o)
ANTHROPIC_API_KEYAnthropic (Claude)
GROQ_API_KEYGroq (fast inference)
BYTEZ_API_KEYBytez
OPENROUTER_API_KEYOpenRouter (multi-model)
TOGETHER_API_KEYTogether AI
GOOGLE_AI_API_KEYGoogle AI (Gemini)

Ollama is supported for local/self-hosted AI. No API key required — just set the Ollama endpoint in the admin dashboard.

VariableDescription
EXTERNAL_AGENT_WEBHOOK_URLWebhook URL for external AI agent
EXTERNAL_AGENT_API_KEYAPI key for the external agent
EXTERNAL_AGENT_CALLBACK_SECRETCallback verification secret
VariableDescriptionDefault
BACKUP_ENCRYPTION_KEYEncryption key for backups
BACKUP_S3_BUCKETS3 bucket for backups
BACKUP_S3_PREFIXS3 prefixopencodehub-backups
BACKUP_RETENTION_DAYSRetention period30
BACKUP_DIRLocal backup directory./backups
VariableDescriptionDefault
AIR_GAPPED_MODEDisable all external API callsfalse

When enabled, OpenCodeHub operates fully offline. AI features are disabled unless you run a local model (e.g., Ollama).

VariableDescription
GRAFANA_OTLP_ENDPOINTGrafana Cloud OTLP endpoint
GRAFANA_INSTANCE_IDGrafana Cloud instance ID
GRAFANA_API_KEYGrafana Cloud API key

OpenCodeHub exports OpenTelemetry traces and Prometheus metrics. See Monitoring for setup details.