From b5d97f633c960a826577fd80cb1d29e392dce34b Mon Sep 17 00:00:00 2001 From: bndw Date: Fri, 23 Jan 2026 21:10:04 -0800 Subject: Move default host from config file to state.json Instead of a separate ~/.config/deploy/config file, the default host is now stored as default_host in state.json. This simplifies the config and keeps all state in one place. The init command now automatically sets the default host if none is configured. --- cmd/deploy/list.go | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'cmd/deploy/list.go') diff --git a/cmd/deploy/list.go b/cmd/deploy/list.go index b74cf35..ce1605b 100644 --- a/cmd/deploy/list.go +++ b/cmd/deploy/list.go @@ -6,7 +6,6 @@ import ( "os" "text/tabwriter" - "github.com/bdw/deploy/internal/config" "github.com/bdw/deploy/internal/state" ) @@ -15,14 +14,16 @@ func runList(args []string) { host := fs.String("host", "", "VPS host (SSH config alias or user@host)") fs.Parse(args) - // Get host from flag or config + // Load state + st, err := state.Load() + if err != nil { + fmt.Fprintf(os.Stderr, "Error loading state: %v\n", err) + os.Exit(1) + } + + // Get host from flag or state default if *host == "" { - cfg, err := config.Load() - if err != nil { - fmt.Fprintf(os.Stderr, "Error loading config: %v\n", err) - os.Exit(1) - } - *host = cfg.Host + *host = st.GetDefaultHost() } if *host == "" { @@ -31,13 +32,6 @@ func runList(args []string) { os.Exit(1) } - // Load state - st, err := state.Load() - if err != nil { - fmt.Fprintf(os.Stderr, "Error loading state: %v\n", err) - os.Exit(1) - } - apps := st.ListApps(*host) if len(apps) == 0 { fmt.Printf("No deployments found for %s\n", *host) -- cgit v1.2.3