diagnostics: properly redact endpoints
This commit is contained in:
parent
a6b77a31dc
commit
6d8c1d2225
|
@ -179,6 +179,17 @@ func diagnosticsCmdRun(cmd *cobra.Command, args []string) {
|
|||
fmt.Fprintln(output, "Logs redacted.")
|
||||
}
|
||||
|
||||
if !diagnosticsArgs.IncludeEndpoints {
|
||||
s := output.String()
|
||||
output.Reset()
|
||||
s = strings.ReplaceAll(s, cfg.PanelLocation, "{redacted}")
|
||||
s = strings.ReplaceAll(s, cfg.Api.Host, "{redacted}")
|
||||
s = strings.ReplaceAll(s, cfg.Api.Ssl.CertificateFile, "{redacted}")
|
||||
s = strings.ReplaceAll(s, cfg.Api.Ssl.KeyFile, "{redacted}")
|
||||
s = strings.ReplaceAll(s, cfg.System.Sftp.Address, "{redacted}")
|
||||
output.WriteString(s)
|
||||
}
|
||||
|
||||
fmt.Println("\n--------------- generated report ---------------")
|
||||
fmt.Println(output.String())
|
||||
fmt.Print("--------------- end of report ---------------\n\n")
|
||||
|
@ -188,16 +199,6 @@ func diagnosticsCmdRun(cmd *cobra.Command, args []string) {
|
|||
survey.AskOne(&survey.Confirm{Message: "Upload to " + diagnosticsArgs.HastebinURL + "?", Default: false}, &upload)
|
||||
}
|
||||
if upload {
|
||||
if !diagnosticsArgs.IncludeEndpoints {
|
||||
s := output.String()
|
||||
output.Reset()
|
||||
a := strings.ReplaceAll(cfg.PanelLocation, s, "{redacted}")
|
||||
a = strings.ReplaceAll(cfg.Api.Host, a, "{redacted}")
|
||||
a = strings.ReplaceAll(cfg.Api.Ssl.CertificateFile, a, "{redacted}")
|
||||
a = strings.ReplaceAll(cfg.Api.Ssl.KeyFile, a, "{redacted}")
|
||||
a = strings.ReplaceAll(cfg.System.Sftp.Address, a, "{redacted}")
|
||||
output.WriteString(a)
|
||||
}
|
||||
u, err := uploadToHastebin(diagnosticsArgs.HastebinURL, output.String())
|
||||
if err == nil {
|
||||
fmt.Println("Your report is available here: ", u)
|
||||
|
|
Loading…
Reference in New Issue
Block a user