caddy environ command prints the environment as seen by the Caddy process.
Usage
Description
Prints the environment as seen by this Caddy process, including:- Caddy-specific paths (home, data, config directories)
- Runtime information (Go version, OS, architecture)
- All environment variables
- Debugging environment variable issues
- Verifying Caddy can see expected variables
- Troubleshooting path and configuration issues
- Understanding how Caddy will behave in different environments
Flags
Environment file(s) to load in KEY=VALUE format before printing.Useful for testing how environment files will be loaded.
Examples
Print current environment
Test environment file loading
.env before printing, so you can verify the variables are set correctly.
Test multiple environment files
Save environment to file
Compare environments
Compare development vs production:Check specific variable
Output Format
The output has two sections:1. Caddy Information
Caddy-specific paths and runtime info:2. Environment Variables
All environment variables inKEY=VALUE format:
Caddy Path Variables
User’s home directory.On Unix:
On Windows:
$HOMEOn Windows:
%USERPROFILE%Directory where Caddy stores data (TLS certificates, ACME accounts, etc.).Default:
- Linux:
$HOME/.local/share/caddy - macOS:
$HOME/Library/Application Support/Caddy - Windows:
%APPDATA%/Caddy
$XDG_DATA_HOME/caddyDirectory where Caddy stores configuration.Default:
- Linux:
$HOME/.config/caddy - macOS:
$HOME/Library/Application Support/Caddy - Windows:
%APPDATA%/Caddy
$XDG_CONFIG_HOME/caddyPath where Caddy saves the last running config for
--resume.Usually {caddy.AppConfigDir}/autosave.jsonEnvironment Variables in Config
If your Caddyfile uses environment variables:Common Use Cases
1. Debug missing variables
2. Verify service manager environment
Environments differ between shells and service managers:3. Test environment files
4. CI/CD debugging
In GitHub Actions or other CI:5. Container debugging
Platform Differences
Linux
Respects XDG Base Directory specification:$XDG_DATA_HOME- Data directory$XDG_CONFIG_HOME- Config directory$XDG_CACHE_HOME- Cache directory
$HOME/.local/share, $HOME/.config, etc.
macOS
Uses standard macOS paths:~/Library/Application Support/Caddy
Windows
Uses Windows environment variables:%APPDATA%\Caddy%USERPROFILE%
Plan 9
Uses$home instead of $HOME.
Security Considerations
To redact sensitive data:Alternative: Print environment when running
You can also print the environment when starting Caddy:caddy environ which exits).
Related Commands
caddy run- Start Caddy (with--environflag)caddy adapt- Test config with environment variablescaddy validate- Validate config with environment variables