| 14 | } |
| 15 | |
| 16 | func runConfig(cmd *cobra.Command, args []string) error { |
| 17 | cfg, err := config.Load() |
| 18 | if err != nil { |
| 19 | return err |
| 20 | } |
| 21 | if cfg == nil { |
| 22 | fmt.Println("Not authenticated. Run `cloudcent init` to authenticate.") |
| 23 | return nil |
| 24 | } |
| 25 | |
| 26 | p, _ := config.Path() |
| 27 | maskedKey := "Not set" |
| 28 | if cfg.APIKey != nil { |
| 29 | key := *cfg.APIKey |
| 30 | if len(key) > 12 { |
| 31 | maskedKey = key[:8] + "..." + key[len(key)-4:] |
| 32 | } else { |
| 33 | maskedKey = "****" |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | fmt.Printf("Config Path: %s\n", p) |
| 38 | fmt.Printf("CLI ID: %s\n", cfg.CliID) |
| 39 | fmt.Printf("API Key: %s\n", maskedKey) |
| 40 | fmt.Println("Status: Authenticated") |
| 41 | return nil |
| 42 | } |