Environment Variables
A comprehensive reference of environment variables that can be used to configure and control Rad's behavior.
Introduction
Rad supports a variety of environment variables that allow you to customize its behavior without modifying configuration files. These variables can control caching, networking, platform compatibility, and more.
Environment variables provide a convenient way to temporarily change behavior or to set up configuration in CI/CD environments.
Core Environment Variables
Variable | Description | Default | Example |
---|---|---|---|
RAD_HOME | Directory where Rad stores its configuration and cache | ~/.rad | RAD_HOME=/custom/path |
RAD_USER_AGENT | Custom User-Agent for requests to gem servers | Rad/[version] | RAD_USER_AGENT="MyCompany/1.0" |
RAD_LOG_LEVEL | Logging verbosity (debug, info, warn, error) | info | RAD_LOG_LEVEL=debug |
RAD_PLATFORM | Override detected platform (e.g., for cross-platform resolution) | [auto-detected] | RAD_PLATFORM=x86_64-linux |
RAD_TIMEOUT | HTTP request timeout in seconds | 30 | RAD_TIMEOUT=60 |
Performance Optimization Variables
Variable | Description | Default | Example |
---|---|---|---|
RAD_LAZY_LOADING | Enable/disable lazy loading of gem metadata (reduces network traffic by 30-40% and memory usage by 20-30%) | true | RAD_LAZY_LOADING=false |
RAD_CACHE_TTL | Time-to-live for cached metadata in seconds | 3600 (1 hour) | RAD_CACHE_TTL=43200 |
RAD_PLATFORM_CACHING | Enable platform compatibility caching (good for large projects) | false | RAD_PLATFORM_CACHING=true |
RAD_CONCURRENCY | Maximum number of concurrent operations | 4 | RAD_CONCURRENCY=8 |
Cache Control
Variable | Description | Default | Example |
---|---|---|---|
RAD_CACHE_DISABLED | Disable the gem metadata cache | false | RAD_CACHE_DISABLED=true |
RAD_CACHE_PATH | Custom path for the gem metadata cache | $RAD_HOME/cache | RAD_CACHE_PATH=/tmp/rad-cache |
Network Configuration
Variable | Description | Default | Example |
---|---|---|---|
RAD_HTTP_PROXY | HTTP proxy server for gem downloads | [none] | RAD_HTTP_PROXY=http://proxy:8080 |
RAD_HTTPS_PROXY | HTTPS proxy server for gem downloads | [none] | RAD_HTTPS_PROXY=http://proxy:8080 |
RAD_NO_PROXY | Hosts to exclude from proxy | [none] | RAD_NO_PROXY=localhost,127.0.0.1 |
RAD_RETRY_COUNT | Number of retry attempts for failed requests | 3 | RAD_RETRY_COUNT=5 |
RAD_RETRY_DELAY | Delay between retry attempts in milliseconds | 1000 | RAD_RETRY_DELAY=2000 |
Authentication
Variable | Description | Default | Example |
---|---|---|---|
RAD_API_KEY | API key for RubyGems.org | [none] | RAD_API_KEY=abc123... |
RAD_GITHUB_TOKEN | GitHub token for accessing private repositories | [none] | RAD_GITHUB_TOKEN=ghp_123... |
Using Environment Variables
Command Line
Environment variables can be set for a single command:
terminal
→RAD_LOG_LEVEL=debug rad install
[DEBUG] Initializing Rad v0.1.0 [DEBUG] Loading configuration from /home/user/.rad/config.toml [DEBUG] Platform detected as x86_64-linux [DEBUG] Fetching gem metadata from https://rubygems.org/... ...
Combined Performance Optimizations
Combine multiple environment variables for maximum performance:
terminal
→RAD_LAZY_LOADING=true RAD_PLATFORM_CACHING=true RAD_CACHE_TTL=43200 rad install
📦 Installing gems with default groups 🔄 Initializing installation with optimized performance settings... Installation path: vendor/bundle Platform: darwin-arm64 (compatible with: darwin-arm64, ruby, macos-arm64) ... 📊 Summary: 0 gems installed, 45 gems already present 🎁 45 gems ready to use in 2.53s
Shell Profile
For persistent settings, add environment variables to your shell profile:
terminal
# Add to ~/.bashrc or ~/.zshrc
export RAD_CONCURRENCY=8
export RAD_CACHE_TTL=3600
Project-Specific Settings
For project-specific settings, you can create a .env file in your project root and load it using a tool like dotenv:
terminal
# .env file in project root RAD_LAZY_LOADING=true RAD_PLATFORM_CACHING=true RAD_CACHE_TTL=43200
For CI environments, setting
RAD_LAZY_LOADING=true
, RAD_PLATFORM_CACHING=true
, and an appropriate RAD_CACHE_TTL
can dramatically improve build times.