From c1b0bb8b149a251a5802557a8d8ab649170a83ad Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 08:06:00 -0800 Subject: Show custom domains in ship list and status Read actual domain from Caddyfile instead of assuming subdomain. Works for both apps and static sites. --- cmd/ship/commands_v2.go | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/ship/commands_v2.go b/cmd/ship/commands_v2.go index 26ee1d3..1b0d09c 100644 --- a/cmd/ship/commands_v2.go +++ b/cmd/ship/commands_v2.go @@ -51,9 +51,16 @@ func runListV2(cmd *cobra.Command, args []string) error { continue } + // Get actual domain from Caddyfile (first word of first line) + domain := fmt.Sprintf("%s.%s", name, hostConfig.BaseDomain) + caddyOut, _ := client.Run(fmt.Sprintf("head -1 /etc/caddy/sites-enabled/%s.caddy 2>/dev/null | awk '{print $1}'", name)) + if d := strings.TrimSpace(caddyOut); d != "" && d != "{" { + domain = d + } + info := output.DeployInfo{ Name: name, - URL: fmt.Sprintf("https://%s.%s", name, hostConfig.BaseDomain), + URL: fmt.Sprintf("https://%s", domain), } // Check if it's docker or binary @@ -98,9 +105,16 @@ func runListV2(cmd *cobra.Command, args []string) error { continue } + // Get actual domain from Caddyfile + domain := fmt.Sprintf("%s.%s", name, hostConfig.BaseDomain) + caddyOut, _ := client.Run(fmt.Sprintf("head -1 /etc/caddy/sites-enabled/%s.caddy 2>/dev/null | awk '{print $1}'", name)) + if d := strings.TrimSpace(caddyOut); d != "" && d != "{" { + domain = d + } + info := output.DeployInfo{ Name: name, - URL: fmt.Sprintf("https://%s.%s", name, hostConfig.BaseDomain), + URL: fmt.Sprintf("https://%s", domain), Type: "static", Running: true, // Static sites are always "running" } @@ -163,10 +177,17 @@ func runStatusV2(cmd *cobra.Command, args []string) error { output.PrintAndExit(output.ErrWithName(output.ErrNotFound, "deployment not found", name)) } + // Get actual domain from Caddyfile + domain := fmt.Sprintf("%s.%s", name, hostConfig.BaseDomain) + caddyOut, _ := client.Run(fmt.Sprintf("head -1 /etc/caddy/sites-enabled/%s.caddy 2>/dev/null | awk '{print $1}'", name)) + if d := strings.TrimSpace(caddyOut); d != "" && d != "{" { + domain = d + } + resp := &output.StatusResponse{ Status: "ok", Name: name, - URL: fmt.Sprintf("https://%s.%s", name, hostConfig.BaseDomain), + URL: fmt.Sprintf("https://%s", domain), } // Determine type and get details -- cgit v1.2.3