(zw *zip.Writer)
| 344 | } |
| 345 | |
| 346 | func (cli *cliSupport) dumpConfigYAML(zw *zip.Writer) error { |
| 347 | fmt.Fprintln(os.Stdout, "Collecting crowdsec config") |
| 348 | |
| 349 | cfg := cli.cfg() |
| 350 | |
| 351 | config, err := os.ReadFile(cfg.FilePath) |
| 352 | if err != nil { |
| 353 | return fmt.Errorf("could not read config file: %w", err) |
| 354 | } |
| 355 | |
| 356 | r := regexp.MustCompile(`(\s+password:|\s+user:|\s+host:)\s+.*`) |
| 357 | |
| 358 | redacted := r.ReplaceAll(config, []byte("$1 ****REDACTED****")) |
| 359 | |
| 360 | cli.writeToZip(zw, SUPPORT_CROWDSEC_CONFIG_PATH, time.Now(), bytes.NewReader(redacted)) |
| 361 | |
| 362 | return nil |
| 363 | } |
| 364 | |
| 365 | func (cli *cliSupport) dumpPprof(ctx context.Context, zw *zip.Writer, prometheusCfg csconfig.PrometheusCfg, endpoint string) error { |
| 366 | fmt.Fprintf(os.Stdout, "Collecting pprof/%s data\n", endpoint) |
no test coverage detected