summaryrefslogtreecommitdiffstats
path: root/cmd/ship
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-17 08:06:00 -0800
committerClawd <ai@clawd.bot>2026-02-17 08:06:00 -0800
commitc1b0bb8b149a251a5802557a8d8ab649170a83ad (patch)
treefe5c46319a99dc6c7e9ca0def98870c97e1ba2dd /cmd/ship
parentc11e0ed6edd10e48780fb965b8d5b730d53b81a0 (diff)
Show custom domains in ship list and status
Read actual domain from Caddyfile instead of assuming subdomain. Works for both apps and static sites.
Diffstat (limited to 'cmd/ship')
-rw-r--r--cmd/ship/commands_v2.go27
1 files changed, 24 insertions, 3 deletions
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 {
51 continue 51 continue
52 } 52 }
53 53
54 // Get actual domain from Caddyfile (first word of first line)
55 domain := fmt.Sprintf("%s.%s", name, hostConfig.BaseDomain)
56 caddyOut, _ := client.Run(fmt.Sprintf("head -1 /etc/caddy/sites-enabled/%s.caddy 2>/dev/null | awk '{print $1}'", name))
57 if d := strings.TrimSpace(caddyOut); d != "" && d != "{" {
58 domain = d
59 }
60
54 info := output.DeployInfo{ 61 info := output.DeployInfo{
55 Name: name, 62 Name: name,
56 URL: fmt.Sprintf("https://%s.%s", name, hostConfig.BaseDomain), 63 URL: fmt.Sprintf("https://%s", domain),
57 } 64 }
58 65
59 // Check if it's docker or binary 66 // Check if it's docker or binary
@@ -98,9 +105,16 @@ func runListV2(cmd *cobra.Command, args []string) error {
98 continue 105 continue
99 } 106 }
100 107
108 // Get actual domain from Caddyfile
109 domain := fmt.Sprintf("%s.%s", name, hostConfig.BaseDomain)
110 caddyOut, _ := client.Run(fmt.Sprintf("head -1 /etc/caddy/sites-enabled/%s.caddy 2>/dev/null | awk '{print $1}'", name))
111 if d := strings.TrimSpace(caddyOut); d != "" && d != "{" {
112 domain = d
113 }
114
101 info := output.DeployInfo{ 115 info := output.DeployInfo{
102 Name: name, 116 Name: name,
103 URL: fmt.Sprintf("https://%s.%s", name, hostConfig.BaseDomain), 117 URL: fmt.Sprintf("https://%s", domain),
104 Type: "static", 118 Type: "static",
105 Running: true, // Static sites are always "running" 119 Running: true, // Static sites are always "running"
106 } 120 }
@@ -163,10 +177,17 @@ func runStatusV2(cmd *cobra.Command, args []string) error {
163 output.PrintAndExit(output.ErrWithName(output.ErrNotFound, "deployment not found", name)) 177 output.PrintAndExit(output.ErrWithName(output.ErrNotFound, "deployment not found", name))
164 } 178 }
165 179
180 // Get actual domain from Caddyfile
181 domain := fmt.Sprintf("%s.%s", name, hostConfig.BaseDomain)
182 caddyOut, _ := client.Run(fmt.Sprintf("head -1 /etc/caddy/sites-enabled/%s.caddy 2>/dev/null | awk '{print $1}'", name))
183 if d := strings.TrimSpace(caddyOut); d != "" && d != "{" {
184 domain = d
185 }
186
166 resp := &output.StatusResponse{ 187 resp := &output.StatusResponse{
167 Status: "ok", 188 Status: "ok",
168 Name: name, 189 Name: name,
169 URL: fmt.Sprintf("https://%s.%s", name, hostConfig.BaseDomain), 190 URL: fmt.Sprintf("https://%s", domain),
170 } 191 }
171 192
172 // Determine type and get details 193 // Determine type and get details