Skip to content

Configuration

AMP is configured through environment variables.

Required Variables

Server

Variable Description Example
PORT API server port 8080
ENVIRONMENT Environment name production

Database

Variable Description Example
DATABASE_URL PostgreSQL connection string postgres://user:pass@host:5432/db

Cache & Queue

Variable Description Example
REDIS_URL Redis connection string redis://localhost:6379
NATS_URL NATS server URL nats://localhost:4222

Authentication

Variable Description Example
CLERK_SECRET_KEY Clerk API secret sk_live_xxxxx
CLERK_PUBLISHABLE_KEY Clerk public key pk_live_xxxxx
JWT_SECRET JWT signing secret (min 32 chars) your-secure-secret

AI Providers

Variable Description Example
ANTHROPIC_API_KEY Claude API key sk-ant-xxxxx
OPENAI_API_KEY OpenAI API key sk-xxxxx
GOOGLE_API_KEY Gemini API key xxxxx

Publishing

Variable Description Example
METRICOOL_TOKEN Metricool API token xxxxx

Optional Variables

Server

Variable Default Description
LOG_LEVEL info Logging level: debug, info, warn, error
LOG_FORMAT json Log format: json, text
REQUEST_TIMEOUT 30s API request timeout
SHUTDOWN_TIMEOUT 30s Graceful shutdown timeout

Worker

Variable Default Description
WORKER_CONCURRENCY 4 Concurrent job workers
WORKER_DRAIN_TIMEOUT 5s Drain timeout on shutdown
JOB_MAX_RETRIES 3 Maximum job retry attempts
JOB_RETRY_DELAY 2s Initial retry delay

Database

Variable Default Description
DB_MAX_OPEN_CONNS 25 Max open connections
DB_MAX_IDLE_CONNS 5 Max idle connections
DB_CONN_MAX_LIFETIME 5m Connection max lifetime

Redis

Variable Default Description
REDIS_MAX_RETRIES 3 Max connection retries
REDIS_POOL_SIZE 10 Connection pool size

Security

Variable Default Description
CORS_ALLOWED_ORIGINS * Allowed CORS origins
RATE_LIMIT_RPS 60 Requests per minute
API_KEY_HASH_COST 10 bcrypt cost factor

Features

Variable Default Description
ENABLE_METRICS false Enable Prometheus metrics
METRICS_PORT 9090 Metrics server port
ENABLE_TRACING false Enable OpenTelemetry tracing

Example Configuration

Development

PORT=8080
ENVIRONMENT=development
LOG_LEVEL=debug
LOG_FORMAT=text

DATABASE_URL=postgres://amp:amp@localhost:5432/amp?sslmode=disable
REDIS_URL=redis://localhost:6379
NATS_URL=nats://localhost:4222

CLERK_SECRET_KEY=sk_test_xxxxx
CLERK_PUBLISHABLE_KEY=pk_test_xxxxx
JWT_SECRET=development-secret-change-in-production

ANTHROPIC_API_KEY=sk-ant-xxxxx

CORS_ALLOWED_ORIGINS=http://localhost:3000

Production

PORT=8080
ENVIRONMENT=production
LOG_LEVEL=info
LOG_FORMAT=json

DATABASE_URL=postgres://amp:secure-password@db.internal:5432/amp?sslmode=require
REDIS_URL=redis://:secure-password@redis.internal:6379
NATS_URL=nats://nats.internal:4222

CLERK_SECRET_KEY=sk_live_xxxxx
CLERK_PUBLISHABLE_KEY=pk_live_xxxxx
JWT_SECRET=your-32-char-minimum-production-secret

ANTHROPIC_API_KEY=sk-ant-xxxxx
OPENAI_API_KEY=sk-xxxxx

METRICOOL_TOKEN=xxxxx

CORS_ALLOWED_ORIGINS=https://app.yourcompany.com
RATE_LIMIT_RPS=300

ENABLE_METRICS=true
DB_MAX_OPEN_CONNS=50
WORKER_CONCURRENCY=8

Configuration Validation

On startup, AMP validates configuration and logs any issues:

level=error msg="Configuration error: CLERK_SECRET_KEY is required"
level=error msg="Configuration error: At least one AI provider API key is required"

Secret Management

For production, use a secret manager:

  • AWS Secrets Manager
  • Google Secret Manager
  • HashiCorp Vault
  • Kubernetes Secrets

Example with AWS:

export ANTHROPIC_API_KEY=$(aws secretsmanager get-secret-value --secret-id amp/anthropic-key --query SecretString --output text)