Add MergeWithConfig
When dealing with logs, sometimes you need to add a new channel. It is
easiest to just specify the json to merge in with the log file. Make
this a function.
Change-Id: I7bd8bde72aa0103ec9c4ae0019164566787c54a2
diff --git a/aos/configuration.cc b/aos/configuration.cc
index ac897bf..d6d276e 100644
--- a/aos/configuration.cc
+++ b/aos/configuration.cc
@@ -417,6 +417,14 @@
return MergeConfiguration(ReadConfig(path, &visited_paths));
}
+FlatbufferDetachedBuffer<Configuration> MergeWithConfig(
+ const Configuration *config, std::string_view json) {
+ FlatbufferDetachedBuffer<Configuration> addition =
+ JsonToFlatbuffer(json, Configuration::MiniReflectTypeTable());
+
+ return MergeConfiguration(MergeFlatBuffers(config, &addition.message()));
+}
+
const Channel *GetChannel(const Configuration *config, std::string_view name,
std::string_view type,
std::string_view application_name, const Node *node) {