Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/renja-g/RiftRelay/llms.txt

Use this file to discover all available pages before exploring further.

Environment Variables

RiftRelay is configured entirely through environment variables. All configuration options have sensible defaults.
Create a .env file in the root directory or set environment variables directly in your shell.

Required Configuration

RIOT_TOKEN

Required - Your Riot Games API token(s).
.env
RIOT_TOKEN=your-riot-token-here
For multiple tokens (load balancing), use comma separation:
.env
RIOT_TOKEN=token1,token2,token3
See Multiple Tokens for more information on using multiple API tokens.

Common Settings

These are the most frequently configured options:
VariableDefaultDescription
PORT8985Server port
QUEUE_CAPACITY2048Max queued requests
ADMISSION_TIMEOUT5mMax wait time for admission (how long a request can wait in the queue)
SHUTDOWN_TIMEOUT20sGraceful shutdown timeout
ENABLE_METRICSfalseEnable /metrics endpoint
ENABLE_PPROFfalseEnable pprof endpoints
ENABLE_SWAGGERtrueEnable Swagger UI

Example Configuration

.env
RIOT_TOKEN=RGAPI-your-token-here
PORT=8985
QUEUE_CAPACITY=4096
ADMISSION_TIMEOUT=10m
ENABLE_METRICS=true
ENABLE_SWAGGER=true

Advanced Configuration

Control how long the server waits for various operations:
.env
# Time to read request headers
SERVER_READ_HEADER_TIMEOUT=10s

# Time to read entire request
SERVER_READ_TIMEOUT=10s

# Time to write response
SERVER_WRITE_TIMEOUT=5m

# Idle connection timeout
SERVER_IDLE_TIMEOUT=90s
Defaults from config.go:
defaultReadHeaderTimeout  = 10 * time.Second
defaultReadTimeout        = 10 * time.Second
defaultWriteTimeout       = 5 * time.Minute
defaultIdleTimeout        = 90 * time.Second
Fine-tune the HTTP client used to communicate with Riot’s API:
.env
# Maximum idle connections across all hosts
TRANSPORT_MAX_IDLE_CONNS=512

# Maximum idle connections per host
TRANSPORT_MAX_IDLE_CONNS_PER_HOST=256

# Maximum connections per host (0 = unlimited)
TRANSPORT_MAX_CONNS_PER_HOST=0

# How long idle connections stay open
TRANSPORT_IDLE_CONN_TIMEOUT=90s

# TLS handshake timeout
TRANSPORT_TLS_HANDSHAKE_TIMEOUT=10s

# Timeout for 100-continue responses
TRANSPORT_EXPECT_CONTINUE_TIMEOUT=1s

# TCP dial timeout
TRANSPORT_DIAL_TIMEOUT=5s

# TCP keep-alive period
TRANSPORT_DIAL_KEEP_ALIVE=30s

# Response header read timeout
TRANSPORT_RESPONSE_HEADER_TIMEOUT=15s

# Force HTTP/2 when possible
TRANSPORT_FORCE_HTTP2=true
Defaults from config.go:
defaultMaxIdleConns           = 512
defaultMaxIdleConnsPerHost    = 256
defaultMaxConnsPerHost        = 0
defaultIdleConnTimeout        = 90 * time.Second
defaultTLSHandshakeTimeout    = 10 * time.Second
defaultExpectContinueTimeout  = 1 * time.Second
defaultDialTimeout            = 5 * time.Second
defaultDialKeepAlive          = 30 * time.Second
defaultResponseHeaderTimeout  = 15 * time.Second
defaultForceAttemptHTTP2      = true
.env
# Additional buffer window added to rate limit windows
ADDITIONAL_WINDOW_SIZE=150ms

# Upstream request timeout (0 = no timeout)
UPSTREAM_TIMEOUT=0

# Default application rate limit (when not specified by Riot)
DEFAULT_APP_RATE_LIMIT=20:1,100:120
Default from config.go:
defaultAdditionalWindowSize   = 150 * time.Millisecond
defaultUpstreamRequestTimeout = 0
defaultAppRateLimit           = "20:1,100:120"
The DEFAULT_APP_RATE_LIMIT format is limit:window,limit:window where window is in seconds. Example: 20:1,100:120 means 20 requests per second and 100 requests per 120 seconds.

Feature Flags

ENABLE_METRICS

Exposes Prometheus-compatible metrics at /metrics:
.env
ENABLE_METRICS=true
curl http://localhost:8985/metrics

ENABLE_PPROF

Enables Go profiling endpoints for performance analysis:
.env
ENABLE_PPROF=true
Access pprof endpoints at:
  • /debug/pprof/ - Index page
  • /debug/pprof/heap - Heap profile
  • /debug/pprof/goroutine - Goroutine profile
  • /debug/pprof/profile - CPU profile
Only enable pprof in development or secure environments as it exposes internal application details.

ENABLE_SWAGGER

Enables the Swagger UI for API exploration:
.env
ENABLE_SWAGGER=true
Access Swagger UI at http://localhost:8985/swagger/
Swagger is enabled by default and is safe to use in production.

Configuration File

The complete .env.example from the source repository:
.env.example
# Required: Riot token (comma separated for multiple tokens)
RIOT_TOKEN=your-riot-token

# Optional: RiftRelay image to pull/run in docker compose
RIFTRELAY_IMAGE=renjag/riftrelay:latest

# Optional overrides (RiftRelay)
PORT=8985
ENABLE_METRICS=true
ENABLE_PPROF=false
ENABLE_SWAGGER=true
SHUTDOWN_TIMEOUT=20s

Duration Format

All timeout and duration values use Go’s duration format:
  • ms - Milliseconds (e.g., 150ms)
  • s - Seconds (e.g., 30s)
  • m - Minutes (e.g., 5m)
  • h - Hours (e.g., 2h)
Examples:
ADMISSION_TIMEOUT=5m
SHUTDOWN_TIMEOUT=20s
ADDITIONAL_WINDOW_SIZE=150ms

Validation

RiftRelay validates all configuration on startup. Invalid values will cause the application to exit with an error message. Common validation errors:
You must set the RIOT_TOKEN environment variable.
The port number must be a valid TCP port (1-65535).
Queue capacity must be a positive integer.
Timeout values cannot be negative.

Docker Configuration

When running with Docker Compose, set environment variables in your .env file:
docker-compose.yml
services:
  riftrelay:
    image: renjag/riftrelay:latest
    env_file:
      - .env
    ports:
      - "${PORT:-8985}:${PORT:-8985}"

Loading Configuration

The configuration loading process from internal/config/config.go:
config.go
func Load() (Config, error) {
	var errs []error

	cfg := Config{
		Port:             defaultPort,
		QueueCapacity:    defaultQueueCapacity,
		AdmissionTimeout: defaultAdmissionTimeout,
		AdditionalWindow: defaultAdditionalWindowSize,
		ShutdownTimeout:  defaultShutdownTimeout,
		MetricsEnabled:   defaultEnableMetrics,
		PprofEnabled:     defaultEnablePprof,
		SwaggerEnabled:   defaultEnableSwagger,
		UpstreamTimeout:  defaultUpstreamRequestTimeout,
		DefaultAppLimits: defaultAppRateLimit,
		// ... server and transport configs
	}

	tokens := splitCSVEnv("RIOT_TOKEN")
	if len(tokens) == 0 {
		errs = append(errs, fmt.Errorf("RIOT_TOKEN env var is required"))
	} else {
		cfg.Tokens = tokens
	}

	// Parse and validate all other settings...
	
	return cfg, nil
}

Next Steps

Priority Requests

Learn about sending high-priority requests

Multiple Tokens

Configure multiple API tokens for higher throughput

Build docs developers (and LLMs) love