From 6b2c04728cd914f27ae62c1df0bf5df24ac9a628 Mon Sep 17 00:00:00 2001 From: Clawd Date: Tue, 17 Feb 2026 07:54:26 -0800 Subject: Remove v1 code, simplify state to just base_domain - Delete all v1 commands (deploy, init, list, status, remove, etc.) - Delete v1 env/ and host/ subcommand directories - Simplify state.go: remove NextPort, Apps, AllocatePort, etc. - Local state now only tracks default_host + base_domain per host - Ports and deploys are tracked on the server (/etc/ship/ports/) - host init now creates minimal state.json --- cmd/ship/host/set_domain.go | 76 --------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 cmd/ship/host/set_domain.go (limited to 'cmd/ship/host/set_domain.go') diff --git a/cmd/ship/host/set_domain.go b/cmd/ship/host/set_domain.go deleted file mode 100644 index fed3b31..0000000 --- a/cmd/ship/host/set_domain.go +++ /dev/null @@ -1,76 +0,0 @@ -package host - -import ( - "fmt" - - "github.com/bdw/ship/internal/state" - "github.com/spf13/cobra" -) - -var setDomainCmd = &cobra.Command{ - Use: "set-domain [domain]", - Short: "Set base domain for auto-generated subdomains", - Long: `Set the base domain used to auto-generate subdomains for deployments. - -When a base domain is configured (e.g., apps.example.com), every deployment -will automatically get a subdomain ({name}.apps.example.com). - -Examples: - ship host set-domain apps.example.com # Set base domain - ship host set-domain --clear # Remove base domain`, - RunE: runSetDomain, -} - -func init() { - setDomainCmd.Flags().Bool("clear", false, "Clear the base domain") -} - -func runSetDomain(cmd *cobra.Command, args []string) error { - st, err := state.Load() - if err != nil { - return fmt.Errorf("error loading state: %w", err) - } - - host, _ := cmd.Flags().GetString("host") - if host == "" { - host = st.GetDefaultHost() - } - - if host == "" { - return fmt.Errorf("--host is required") - } - - clear, _ := cmd.Flags().GetBool("clear") - - if !clear && len(args) == 0 { - // Show current base domain - hostState := st.GetHost(host) - if hostState.BaseDomain == "" { - fmt.Printf("No base domain configured for %s\n", host) - } else { - fmt.Printf("Base domain for %s: %s\n", host, hostState.BaseDomain) - } - return nil - } - - hostState := st.GetHost(host) - - if clear { - hostState.BaseDomain = "" - if err := st.Save(); err != nil { - return fmt.Errorf("error saving state: %w", err) - } - fmt.Printf("Cleared base domain for %s\n", host) - return nil - } - - hostState.BaseDomain = args[0] - if err := st.Save(); err != nil { - return fmt.Errorf("error saving state: %w", err) - } - - fmt.Printf("Set base domain for %s: %s\n", host, args[0]) - fmt.Println("\nNew deployments will automatically use subdomains like:") - fmt.Printf(" myapp.%s\n", args[0]) - return nil -} -- cgit v1.2.3