summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/ship/deploy_v2.go6
-rw-r--r--cmd/ship/host_v2.go17
2 files changed, 10 insertions, 13 deletions
diff --git a/cmd/ship/deploy_v2.go b/cmd/ship/deploy_v2.go
index 16e12db..af4e3a7 100644
--- a/cmd/ship/deploy_v2.go
+++ b/cmd/ship/deploy_v2.go
@@ -21,7 +21,7 @@ func deployV2(path string, opts deployV2Options) {
21 21
22 // Validate name if provided 22 // Validate name if provided
23 if opts.Name != "" { 23 if opts.Name != "" {
24 if err := validateName(opts.Name); err != nil { 24 if err := validateNameV2(opts.Name); err != nil {
25 output.PrintAndExit(err) 25 output.PrintAndExit(err)
26 } 26 }
27 } 27 }
@@ -157,8 +157,8 @@ type deployContext struct {
157 Opts deployV2Options 157 Opts deployV2Options
158} 158}
159 159
160// validateName checks if name matches allowed pattern 160// validateNameV2 checks if name matches allowed pattern
161func validateName(name string) *output.ErrorResponse { 161func validateNameV2(name string) *output.ErrorResponse {
162 // Must be lowercase alphanumeric with hyphens, 1-63 chars 162 // Must be lowercase alphanumeric with hyphens, 1-63 chars
163 pattern := regexp.MustCompile(`^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$|^[a-z0-9]$`) 163 pattern := regexp.MustCompile(`^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$|^[a-z0-9]$`)
164 if !pattern.MatchString(name) { 164 if !pattern.MatchString(name) {
diff --git a/cmd/ship/host_v2.go b/cmd/ship/host_v2.go
index 0d70f5d..dec8b59 100644
--- a/cmd/ship/host_v2.go
+++ b/cmd/ship/host_v2.go
@@ -272,16 +272,13 @@ var hostStatusV2Cmd = &cobra.Command{
272 caddyStatus, _ := client.RunSudo("systemctl is-active caddy") 272 caddyStatus, _ := client.RunSudo("systemctl is-active caddy")
273 dockerStatus, _ := client.RunSudo("systemctl is-active docker") 273 dockerStatus, _ := client.RunSudo("systemctl is-active docker")
274 274
275 resp := map[string]interface{}{ 275 // Print as JSON directly (custom response type)
276 "status": "ok", 276 fmt.Printf(`{"status":"ok","host":%q,"domain":%q,"caddy":%t,"docker":%t}`+"\n",
277 "host": hostName, 277 hostName,
278 "domain": hostConfig.BaseDomain, 278 hostConfig.BaseDomain,
279 "caddy": strings.TrimSpace(caddyStatus) == "active", 279 strings.TrimSpace(caddyStatus) == "active",
280 "docker": strings.TrimSpace(dockerStatus) == "active", 280 strings.TrimSpace(dockerStatus) == "active",
281 } 281 )
282
283 // Use JSON encoder directly since this is a custom response
284 output.Print(&output.ListResponse{Status: "ok"}) // Placeholder
285 return nil 282 return nil
286 }, 283 },
287} 284}