Skip to main content

Configuration

Rampart is configured entirely through environment variables. All variables are prefixed with RAMPART_ (except social login providers which use RAMPART_GOOGLE_*, RAMPART_GITHUB_*, and RAMPART_APPLE_*).

Environment Variables Reference

Server

VariableDescriptionDefault
RAMPART_PORTHTTP listen port8080
RAMPART_ISSUERPublic base URL for OIDC Discovery and JWT iss claimhttp://localhost:8080

Database

VariableDescriptionDefault
RAMPART_DB_URLPostgreSQL connection string(required)

The database connection string follows the standard PostgreSQL URI format:

postgres://user:password@host:port/database?sslmode=require

Supported sslmode values: disable, require, verify-ca, verify-full. Use verify-full in production.

Signing Keys

VariableDescriptionDefault
RAMPART_SIGNING_KEY_PATHPath to RSA private key (PEM format)rampart-signing-key.pem

If the signing key file does not exist at the configured path, Rampart generates a 2048-bit RSA key pair on first startup and persists it there. In production, you should generate and manage your own keys:

openssl genrsa -out rampart-signing-key.pem 2048
openssl rsa -in rampart-signing-key.pem -pubout -out rampart-signing-key-pub.pem

Tokens

VariableDescriptionDefault
RAMPART_ACCESS_TOKEN_TTLAccess token lifetime in seconds900 (15 minutes)
RAMPART_REFRESH_TOKEN_TTLRefresh token lifetime in seconds604800 (7 days)

Both values are integers representing seconds.

CORS

VariableDescriptionDefault
RAMPART_ALLOWED_ORIGINSComma-separated allowed origins(none)

Security

VariableDescriptionDefault
RAMPART_HSTS_ENABLEDEnable HTTP Strict Transport Security headerAuto-enabled when RAMPART_ISSUER starts with https://
RAMPART_SECURE_COOKIESSet the Secure flag on all cookies (requires HTTPS)false
RAMPART_ENCRYPTION_KEYHex-encoded 32-byte key for encrypting secrets at rest(none — secrets stored in plaintext)
RAMPART_METRICS_TOKENBearer token required to access /metrics endpoint(none — endpoint disabled)
RAMPART_TRUSTED_PROXIESComma-separated CIDR ranges or IPs whose X-Forwarded-For / X-Real-IP headers are trusted for rate limiting(none — proxy headers ignored)

Rate Limiting

Per-IP rate limits in requests per minute for authentication endpoints.

VariableDescriptionDefault
RAMPART_RATE_LIMIT_LOGINLogin endpoint rate limit (req/min per IP)10
RAMPART_RATE_LIMIT_REGISTERRegistration endpoint rate limit (req/min per IP)5
RAMPART_RATE_LIMIT_TOKENToken endpoint rate limit (req/min per IP)10

Logging

VariableDescriptionDefault
RAMPART_LOG_LEVELLog level: debug, info, warn, errorinfo
RAMPART_LOG_FORMATOutput format: pretty, text, jsonpretty

SMTP (Email)

Required for transactional emails (password reset, email verification, etc.). If RAMPART_SMTP_HOST is not set, email features are disabled.

VariableDescriptionDefault
RAMPART_SMTP_HOSTSMTP server hostname(none)
RAMPART_SMTP_PORTSMTP server port587
RAMPART_SMTP_USERNAMESMTP authentication username(none)
RAMPART_SMTP_PASSWORDSMTP authentication password(none)
RAMPART_SMTP_FROMSender address for outgoing emails(none)

Social Login Providers

Configure OAuth credentials to enable social login. Each provider is optional — only configure the ones you need.

Google

VariableDescription
RAMPART_GOOGLE_CLIENT_IDGoogle OAuth 2.0 client ID
RAMPART_GOOGLE_CLIENT_SECRETGoogle OAuth 2.0 client secret

GitHub

VariableDescription
RAMPART_GITHUB_CLIENT_IDGitHub OAuth App client ID
RAMPART_GITHUB_CLIENT_SECRETGitHub OAuth App client secret

Apple

VariableDescription
RAMPART_APPLE_CLIENT_IDApple Services ID
RAMPART_APPLE_TEAM_IDApple Developer Team ID
RAMPART_APPLE_KEY_IDApple private key ID
RAMPART_APPLE_PRIVATE_KEYApple private key contents (PEM format)