outputMigratedConfig marshals the map to YAML and prints it to stdout with a header comment.
(m map[string]interface{})
| 390 | |
| 391 | // outputMigratedConfig marshals the map to YAML and prints it to stdout with a header comment. |
| 392 | func outputMigratedConfig(m map[string]interface{}) error { |
| 393 | yamlBytes, err := yaml.Marshal(m) |
| 394 | if err != nil { |
| 395 | return fmt.Errorf("failed to marshal migrated config: %w", err) |
| 396 | } |
| 397 | |
| 398 | var sb strings.Builder |
| 399 | sb.WriteString("# Generated by tempo-cli migrate config\n") |
| 400 | sb.WriteString("# Review before deploying. Remove compaction_disabled after decommissioning 2.x.\n") |
| 401 | sb.Write(yamlBytes) |
| 402 | |
| 403 | fmt.Print(sb.String()) |
| 404 | return nil |
| 405 | } |
| 406 | |
| 407 | // setNestedValue sets a value at a path of keys in a nested map structure, |
| 408 | // creating intermediate maps as needed without overwriting existing ones. |