diff options
| author | Clawd <ai@clawd.bot> | 2026-02-17 08:11:19 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-17 08:11:19 -0800 |
| commit | 6f02ec84a8299fc5577f147cc8741c8a4b162b64 (patch) | |
| tree | 020f3690e92732dcba723be0cfaef649f46de137 /cmd/ship/env/list.go | |
| parent | 4b5a2656df13181b637c59c29ff31751e11cf22a (diff) | |
| parent | 05ea98df57599775c1d5bfea336012b075531670 (diff) | |
Merge agent-mode: v2 rewrite complete
- Removed all v1 code (-2800 lines)
- Simplified state to just default_host + base_domain
- Atomic port allocation via flock
- --container-port flag for Docker
- Custom domains shown in ship list
- Caddyfiles preserved on redeploy
- JSON output by default, --pretty for humans
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 | } | ||
