diff options
| author | Clawd <ai@clawd.bot> | 2026-02-17 07:54:26 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-17 07:54:26 -0800 |
| commit | 6b2c04728cd914f27ae62c1df0bf5df24ac9a628 (patch) | |
| tree | 8a103ac79194a05fae438b0da105589aaa6b78d9 /cmd/ship/env/list.go | |
| parent | 5e5de4ea1aa98f75d470e4a61644d4b9f100c4b0 (diff) | |
Remove v1 code, simplify state to just base_domain
- Delete all v1 commands (deploy, init, list, status, remove, etc.)
- Delete v1 env/ and host/ subcommand directories
- Simplify state.go: remove NextPort, Apps, AllocatePort, etc.
- Local state now only tracks default_host + base_domain per host
- Ports and deploys are tracked on the server (/etc/ship/ports/)
- host init now creates minimal state.json
Diffstat (limited to 'cmd/ship/env/list.go')
| -rw-r--r-- | cmd/ship/env/list.go | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/cmd/ship/env/list.go b/cmd/ship/env/list.go deleted file mode 100644 index e94b83a..0000000 --- a/cmd/ship/env/list.go +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | package env | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "fmt" | ||
| 5 | "strings" | ||
| 6 | |||
| 7 | "github.com/bdw/ship/internal/state" | ||
| 8 | "github.com/spf13/cobra" | ||
| 9 | ) | ||
| 10 | |||
| 11 | var listCmd = &cobra.Command{ | ||
| 12 | Use: "list <app>", | ||
| 13 | Short: "List environment variables for an app", | ||
| 14 | Args: cobra.ExactArgs(1), | ||
| 15 | RunE: runList, | ||
| 16 | } | ||
| 17 | |||
| 18 | func runList(cmd *cobra.Command, args []string) error { | ||
| 19 | name := args[0] | ||
| 20 | if err := state.ValidateName(name); err != nil { | ||
| 21 | return err | ||
| 22 | } | ||
| 23 | |||
| 24 | st, err := state.Load() | ||
| 25 | if err != nil { | ||
| 26 | return fmt.Errorf("error loading state: %w", err) | ||
| 27 | } | ||
| 28 | |||
| 29 | host, _ := cmd.Flags().GetString("host") | ||
| 30 | if host == "" { | ||
| 31 | host = st.GetDefaultHost() | ||
| 32 | } | ||
| 33 | |||
| 34 | if host == "" { | ||
| 35 | return fmt.Errorf("--host is required") | ||
| 36 | } | ||
| 37 | |||
| 38 | app, err := st.GetApp(host, name) | ||
| 39 | if err != nil { | ||
| 40 | return err | ||
| 41 | } | ||
| 42 | |||
| 43 | if app.Type != "app" { | ||
| 44 | return fmt.Errorf("env is only available for apps, not static sites") | ||
| 45 | } | ||
| 46 | |||
| 47 | fmt.Printf("Environment variables for %s:\n\n", name) | ||
| 48 | if len(app.Env) == 0 { | ||
| 49 | fmt.Println(" (none)") | ||
| 50 | } else { | ||
| 51 | for k, v := range app.Env { | ||
| 52 | display := v | ||
| 53 | if isSensitive(k) { | ||
| 54 | display = "***" | ||
| 55 | } | ||
| 56 | fmt.Printf(" %s=%s\n", k, display) | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | return nil | ||
| 61 | } | ||
| 62 | |||
| 63 | func isSensitive(key string) bool { | ||
| 64 | key = strings.ToLower(key) | ||
| 65 | sensitiveWords := []string{"key", "secret", "password", "token", "api"} | ||
| 66 | for _, word := range sensitiveWords { | ||
| 67 | if strings.Contains(key, word) { | ||
| 68 | return true | ||
| 69 | } | ||
| 70 | } | ||
| 71 | return false | ||
| 72 | } | ||
