()
| 57 | } |
| 58 | |
| 59 | func showConfig() error { |
| 60 | cfg := cfgManager.GetConfig() |
| 61 | err := cfgManager.LoadCredentials() |
| 62 | if err != nil { |
| 63 | return fmt.Errorf("failed to load credentials: %w", err) |
| 64 | } |
| 65 | creds := cfgManager.GetCredentials() |
| 66 | |
| 67 | fmt.Printf("Configuration:\n") |
| 68 | if cfg.PatchmonServer != "" { |
| 69 | fmt.Printf(" Server: %s\n", cfg.PatchmonServer) |
| 70 | } else { |
| 71 | fmt.Printf(" Server: Not configured\n") |
| 72 | } |
| 73 | fmt.Printf(" Agent Version: %s\n", pkgversion.Version) |
| 74 | fmt.Printf(" Config File: %s\n", cfgManager.GetConfigFile()) |
| 75 | fmt.Printf(" Credentials File: %s\n", cfg.CredentialsFile) |
| 76 | fmt.Printf(" Log File: %s\n", cfg.LogFile) |
| 77 | fmt.Printf(" Log Level: %s\n", cfg.LogLevel) |
| 78 | |
| 79 | fmt.Printf("\nCredentials:\n") |
| 80 | if creds != nil { |
| 81 | fmt.Printf(" API ID: %s\n", creds.APIID) |
| 82 | // Show only first 8 characters of API key for security |
| 83 | if len(creds.APIKey) >= 0 { |
| 84 | fmt.Print(" API Key: Set ✅\n") |
| 85 | } else { |
| 86 | fmt.Print(" API Key: Not set ❌\n") |
| 87 | } |
| 88 | } else { |
| 89 | fmt.Printf(" Credentials: Not configured\n") |
| 90 | } |
| 91 | |
| 92 | return nil |
| 93 | } |
| 94 | |
| 95 | func configureCreds(apiID, apiKey, serverURL string) error { |
| 96 | logger.Info("Setting up credentials...") |
no test coverage detected