Add utility function for appending channel to a config

This is helpful for certain log-replay tasks.

Change-Id: I46da77a0481ab1f7d61f7e9eb3ce8fe553e6c7ae
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/log_replayer.cc b/aos/events/logging/log_replayer.cc
index 4de4052..0f7444a 100644
--- a/aos/events/logging/log_replayer.cc
+++ b/aos/events/logging/log_replayer.cc
@@ -70,25 +70,14 @@
     const aos::Configuration *raw_config = FLAGS_config.empty()
                                                ? config_reader.configuration()
                                                : &config.message();
-    const std::string channel_node =
-        aos::configuration::MultiNode(raw_config)
-            ? absl::StrFormat("\"source_node\": \"%s%s",
-                              aos::configuration::GetMyNode(raw_config)
-                                  ->name()
-                                  ->string_view(),
-                              "\",")
-            : "";
-    config = aos::configuration::MergeWithConfig(
-        raw_config,
-        aos::configuration::AddSchema(
-            absl::StrFormat(
-                "{ \"channels\": [{ \"name\": \"/timing\", \"type\": "
-                "\"aos.timing.ReplayTiming\", \"max_size\": 10000, "
-                "\"frequency\": 10000, %s %s",
-                channel_node, "\"num_senders\": 2 }]}"),
-            {aos::FlatbufferVector<reflection::Schema>(
-                aos::FlatbufferSpan<reflection::Schema>(
-                    aos::timing::ReplayTimingSchema()))}));
+    aos::ChannelT channel_overrides;
+    channel_overrides.max_size = 10000;
+    channel_overrides.frequency = 10000;
+    config = aos::configuration::AddChannelToConfiguration(
+        raw_config, "/timing",
+        aos::FlatbufferSpan<reflection::Schema>(
+            aos::timing::ReplayTimingSchema()),
+        aos::configuration::GetMyNode(raw_config), channel_overrides);
   }
 
   if (!FLAGS_merge_with_config.empty()) {