diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index 546db6eb94989edca8c3239340a93bf335835f0b..a455a5c840733bf56da6078bd4b69380d76274e9 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -655,6 +655,19 @@ Configurable *ftl::config::configure(ftl::config::json_t &cfg) { return rootcfg; } +// Remove all $ keys from json +static void stripJSON(nlohmann::json &j) { + for(auto &el : j.items()) { + if (el.key()[0] == '$') { + j.erase(el.key()); + continue; + } + if (el.value().is_structured()) { + stripJSON(el.value()); + } + } +} + static std::atomic_bool doing_cleanup = false; void ftl::config::cleanup() { if (doing_cleanup) return; @@ -672,6 +685,7 @@ void ftl::config::cleanup() { } config_instance.clear(); + stripJSON(config_restore); ftl::saveJSON(std::string(FTL_LOCAL_CONFIG_ROOT "/")+cfg_root_str+std::string("_session.json"), config_restore); doing_cleanup = false;