diff options
Diffstat (limited to 'internal/state')
| -rw-r--r-- | internal/state/state.go | 13 |
1 files changed, 12 insertions, 1 deletions
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 ( | |||
| 9 | 9 | ||
| 10 | // State represents the entire local deployment state | 10 | // State represents the entire local deployment state |
| 11 | type State struct { | 11 | type State struct { |
| 12 | Hosts map[string]*Host `json:"hosts"` | 12 | DefaultHost string `json:"default_host,omitempty"` |
| 13 | Hosts map[string]*Host `json:"hosts"` | ||
| 13 | } | 14 | } |
| 14 | 15 | ||
| 15 | // Host represents deployment state for a single VPS | 16 | // Host represents deployment state for a single VPS |
| @@ -137,6 +138,16 @@ func (s *State) ListApps(host string) map[string]*App { | |||
| 137 | return h.Apps | 138 | return h.Apps |
| 138 | } | 139 | } |
| 139 | 140 | ||
| 141 | // GetDefaultHost returns the default host, or empty string if not set | ||
| 142 | func (s *State) GetDefaultHost() string { | ||
| 143 | return s.DefaultHost | ||
| 144 | } | ||
| 145 | |||
| 146 | // SetDefaultHost sets the default host | ||
| 147 | func (s *State) SetDefaultHost(host string) { | ||
| 148 | s.DefaultHost = host | ||
| 149 | } | ||
| 150 | |||
| 140 | // statePath returns the path to the state file | 151 | // statePath returns the path to the state file |
| 141 | func statePath() string { | 152 | func statePath() string { |
| 142 | home, err := os.UserHomeDir() | 153 | home, err := os.UserHomeDir() |
