Skip to content

Environment Variables

ReArch can be configured at runtime using environment variables. These take precedence over values in rearch.config.mjs.

Set environment variables in your shell, a .env file, or your deployment platform.

Terminal window
# .env file
REARCH_API_KEY=sk_live_abc123
REARCH_ENV=production
REARCH_LOG_LEVEL=info

Load from a .env file:

Terminal window
rearch dev --env-file .env.local
VariableDefaultDescription
REARCH_API_KEYAPI key for authentication (required)
REARCH_ENVdevelopmentEnvironment: development, staging, production
REARCH_LOG_LEVELinfoLog level: debug, info, warn, error, silent
REARCH_CONFIG_PATH./rearch.config.mjsPath to configuration file
VariableDefaultDescription
PORT3000Server port
HOSTlocalhostServer host
REARCH_MAX_WORKERSCPU countMaximum worker threads
REARCH_TIMEOUT30000Default request timeout in ms
VariableDefaultDescription
REARCH_AGENT_CONCURRENCY5Max concurrent agent runs
REARCH_AGENT_TIMEOUT60000Agent execution timeout in ms
REARCH_AGENT_RETRIES3Number of retry attempts
REARCH_AGENT_LOG_DIR./logs/agentsDirectory for agent logs
VariableDefaultDescription
REARCH_PIPELINE_BATCH_SIZE100Items per pipeline batch
REARCH_PIPELINE_PARALLELISM4Parallel pipeline workers
REARCH_PIPELINE_DLQ_ENABLEDtrueEnable dead letter queue
VariableDefaultDescription
GITHUB_TOKENGitHub personal access token
REARCH_GITHUB_AUTO_SYNCfalseAuto-sync to GitHub
REARCH_SLACK_WEBHOOKSlack webhook URL for notifications
REARCH_SLACK_CHANNEL#rearchDefault Slack channel
VariableDefaultDescription
DATABASE_URLDatabase connection string
REARCH_DB_POOL_SIZE10Connection pool size
REARCH_DB_SSLfalseEnable SSL for database connections
VariableDefaultDescription
REARCH_CORS_ORIGINS*Allowed CORS origins (comma-separated)
REARCH_RATE_LIMIT60Requests per minute per client
REARCH_ENCRYPTION_KEYKey for encrypting sensitive data at rest

When the same setting is defined in multiple places, ReArch uses the following precedence (highest to lowest):

  1. Command-line flags
  2. Environment variables
  3. .env file values
  4. rearch.config.mjs values
  5. Default values