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. --- internal/state/state.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'internal/state/state.go') diff --git a/internal/state/state.go b/internal/state/state.go index eb1dee8..def0bcf 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -9,7 +9,8 @@ import ( // State represents the entire local deployment state type State struct { - Hosts map[string]*Host `json:"hosts"` + DefaultHost string `json:"default_host,omitempty"` + Hosts map[string]*Host `json:"hosts"` } // Host represents deployment state for a single VPS @@ -137,6 +138,16 @@ func (s *State) ListApps(host string) map[string]*App { return h.Apps } +// GetDefaultHost returns the default host, or empty string if not set +func (s *State) GetDefaultHost() string { + return s.DefaultHost +} + +// SetDefaultHost sets the default host +func (s *State) SetDefaultHost(host string) { + s.DefaultHost = host +} + // statePath returns the path to the state file func statePath() string { home, err := os.UserHomeDir() -- cgit v1.2.3