Usage
Options
Name or ID of the machine to get the configuration from. If not specified, uses the currently connected machine
Disable syntax highlighting for the output
Description
Theconfig command displays the complete Caddy configuration (Caddyfile) that’s currently running on a machine. This includes:
- Custom global configuration (if provided via
--caddyfileflag during deployment) - Auto-generated configuration from service port definitions
- Service-specific Caddy configuration from compose files
Examples
View Caddy config from current machine
View config from specific machine
Check configuration on a different machine:Get plain text output
Disable syntax highlighting for scripting:Understanding the Configuration
Auto-generated Sections
Uncloud automatically generates Caddyfile directives for:- Service HTTP/HTTPS ports: From
x-portsin compose files or-pflag inuc run - Cluster domain wildcards: For
*.CLUSTER_ID.cluster.uncloud.rundomains - TLS configuration: Automatic Let’s Encrypt integration
- Logging: Structured logging to stdout
Custom Sections
If you deployed Caddy with the--caddyfile flag, your custom configuration appears at the top of the file.
Service-specific Configuration
Services can include custom Caddy directives via thex-caddy field in compose files:
Common Uses
Debug routing issues
Check if your service’s routing configuration is correct:Verify TLS settings
Ensure HTTPS is configured properly:Export configuration
Save the current config for reference or backup:Compare configurations
Check if configurations differ across machines:All machines running Caddy should have identical configurations. If they differ, run
uc caddy deploy to synchronize them.Configuration Sources
The Caddy configuration is built from these sources (in order):- Custom global config - From
--caddyfileflag during deployment - Service ingress rules - From HTTP/HTTPS port definitions
- Service-specific directives - From
x-caddyin compose files - Cluster domain rules - For managed
*.uncld.devdomains
Troubleshooting
Configuration looks wrong
If the configuration doesn’t match your expectations:- Check service definitions with
uc service inspect SERVICE - Verify compose file port definitions
- Redeploy Caddy:
uc caddy deploy
Configuration differs across machines
All machines should have the same config. If they don’t:Syntax highlighting not working
If colors don’t appear:- Ensure your terminal supports colors
- Try updating the Uncloud CLI
- Use
--no-colorflag to disable
Related Commands
uc caddy deploy- Deploy or update Caddyuc service ls- View services with their endpointsuc service inspect- Get service details
