MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / showConfig

Function showConfig

agent-source-code/cmd/patchmon-agent/commands/config.go:59–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57}
58
59func 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
95func configureCreds(apiID, apiKey, serverURL string) error {
96 logger.Info("Setting up credentials...")

Callers 1

config.goFile · 0.85

Calls 4

GetConfigMethod · 0.80
LoadCredentialsMethod · 0.80
GetCredentialsMethod · 0.80
GetConfigFileMethod · 0.80

Tested by

no test coverage detected