diff options
| author | bndw <ben@bdw.to> | 2026-01-24 16:55:52 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-01-24 16:55:52 -0800 |
| commit | 8a3cff0dd7eb88cadb73a6df4e14f85450d63317 (patch) | |
| tree | 461e3b7af3a71f92c8a916f2e4578a63e2d92f13 /cmd/ship/main.go | |
| parent | 9c222e3fe49c6786c1719b6100564d413d7f8db6 (diff) | |
Add auto-generated subdomain feature
When a base domain is configured on a host (e.g., apps.example.com),
deployments automatically get a subdomain ({name}.apps.example.com).
Custom --domain can still be provided to route both domains.
- Add BaseDomain field to Host state
- Add --base-domain flag to host init
- Add 'ship host set-domain' command to update base domain
- Update deploy flow to auto-generate subdomains
- Fix error display (errors were being silently swallowed)
- Remove placeholder email from Caddyfile template
Diffstat (limited to 'cmd/ship/main.go')
| -rw-r--r-- | cmd/ship/main.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/ship/main.go b/cmd/ship/main.go index 27fe8b7..a6984ec 100644 --- a/cmd/ship/main.go +++ b/cmd/ship/main.go | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | package main | 1 | package main |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | ||
| 4 | "os" | 5 | "os" |
| 5 | 6 | ||
| 6 | "github.com/bdw/ship/cmd/ship/env" | 7 | "github.com/bdw/ship/cmd/ship/env" |
| @@ -57,7 +58,7 @@ func init() { | |||
| 57 | rootCmd.Flags().String("binary", "", "Path to Go binary (for app deployment)") | 58 | rootCmd.Flags().String("binary", "", "Path to Go binary (for app deployment)") |
| 58 | rootCmd.Flags().Bool("static", false, "Deploy as static site") | 59 | rootCmd.Flags().Bool("static", false, "Deploy as static site") |
| 59 | rootCmd.Flags().String("dir", ".", "Directory to deploy (for static sites)") | 60 | rootCmd.Flags().String("dir", ".", "Directory to deploy (for static sites)") |
| 60 | rootCmd.Flags().String("domain", "", "Domain name (required)") | 61 | rootCmd.Flags().String("domain", "", "Custom domain (optional if base domain configured)") |
| 61 | rootCmd.Flags().String("name", "", "App name (default: inferred from binary or directory)") | 62 | rootCmd.Flags().String("name", "", "App name (default: inferred from binary or directory)") |
| 62 | rootCmd.Flags().Int("port", 0, "Port override (default: auto-allocate)") | 63 | rootCmd.Flags().Int("port", 0, "Port override (default: auto-allocate)") |
| 63 | rootCmd.Flags().StringArray("env", nil, "Environment variable (KEY=VALUE, can be specified multiple times)") | 64 | rootCmd.Flags().StringArray("env", nil, "Environment variable (KEY=VALUE, can be specified multiple times)") |
| @@ -79,6 +80,7 @@ func init() { | |||
| 79 | 80 | ||
| 80 | func main() { | 81 | func main() { |
| 81 | if err := rootCmd.Execute(); err != nil { | 82 | if err := rootCmd.Execute(); err != nil { |
| 83 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) | ||
| 82 | os.Exit(1) | 84 | os.Exit(1) |
| 83 | } | 85 | } |
| 84 | } | 86 | } |
