diff --git a/components/common/cpp/src/configurable.cpp b/components/common/cpp/src/configurable.cpp index fd8db20e3d5f0a76518847f5e97c6876f8387b8b..1f377fc5185cdc533d8c5823514a3fb4bfda3e24 100644 --- a/components/common/cpp/src/configurable.cpp +++ b/components/common/cpp/src/configurable.cpp @@ -22,6 +22,10 @@ Configurable::Configurable(nlohmann::json &config) : config_(&config) { LOG(FATAL) << "Configurable json is not an object: " << config; } + /*if (!config.contains("$id")) { + config["$id"] = "ftl://utu.fi"; + }*/ + ftl::config::registerConfigurable(this); } diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index 522ce44bd0a73362d4f8b5ba9e91d61f124a2231..20173db52ad3486eaf5c64be0b434ee7a58e964a 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -276,6 +276,8 @@ static void _indexConfig(json_t &cfg) { } ftl::Configurable *ftl::config::find(const std::string &uri) { + if (uri.size() == 0) return nullptr; + std::string actual_uri = uri; if (uri[0] == '/') { if (uri.size() == 1) { @@ -876,6 +878,10 @@ Configurable *ftl::config::configure(int argc, char **argv, const std::string &r string root_str = (options.find("root") != options.end()) ? nlohmann::json::parse(options["root"]).get<string>() : root; cfg_root_str = root_str; + if (!config.contains("$id")) { + config["$id"] = "ftl://utu.fi"; + } + if (options.find("id") != options.end()) config["$id"] = nlohmann::json::parse(options["id"]).get<string>(); _indexConfig(config);