diff options
| author | bndw <ben@bdw.to> | 2026-01-23 21:10:04 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-01-23 21:10:04 -0800 |
| commit | b5d97f633c960a826577fd80cb1d29e392dce34b (patch) | |
| tree | 312b934506f835bcc77c4dcbb9e38a27efbf1528 /cmd/deploy/deploy.go | |
| parent | 98b9af372025595e8a4255538e2836e019311474 (diff) | |
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.
Diffstat (limited to 'cmd/deploy/deploy.go')
| -rw-r--r-- | cmd/deploy/deploy.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd/deploy/deploy.go b/cmd/deploy/deploy.go index 2b3ab4a..ee7ee4a 100644 --- a/cmd/deploy/deploy.go +++ b/cmd/deploy/deploy.go | |||
| @@ -9,7 +9,6 @@ import ( | |||
| 9 | "strconv" | 9 | "strconv" |
| 10 | "strings" | 10 | "strings" |
| 11 | 11 | ||
| 12 | "github.com/bdw/deploy/internal/config" | ||
| 13 | "github.com/bdw/deploy/internal/ssh" | 12 | "github.com/bdw/deploy/internal/ssh" |
| 14 | "github.com/bdw/deploy/internal/state" | 13 | "github.com/bdw/deploy/internal/state" |
| 15 | "github.com/bdw/deploy/internal/templates" | 14 | "github.com/bdw/deploy/internal/templates" |
| @@ -55,14 +54,14 @@ func runDeploy(args []string) { | |||
| 55 | 54 | ||
| 56 | fs.Parse(args) | 55 | fs.Parse(args) |
| 57 | 56 | ||
| 58 | // Get host from flag or config | 57 | // Get host from flag or state default |
| 59 | if *host == "" { | 58 | if *host == "" { |
| 60 | cfg, err := config.Load() | 59 | st, err := state.Load() |
| 61 | if err != nil { | 60 | if err != nil { |
| 62 | fmt.Fprintf(os.Stderr, "Error loading config: %v\n", err) | 61 | fmt.Fprintf(os.Stderr, "Error loading state: %v\n", err) |
| 63 | os.Exit(1) | 62 | os.Exit(1) |
| 64 | } | 63 | } |
| 65 | *host = cfg.Host | 64 | *host = st.GetDefaultHost() |
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | if *host == "" || *domain == "" { | 67 | if *host == "" || *domain == "" { |
