From a34a69577c644552ac6df93056c5eb0f03b50fca Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Wed, 5 Jun 2019 14:42:04 +0300 Subject: [PATCH] Support jsonc config files --- components/common/cpp/src/configuration.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index 8c6173b08..b2e8c23c7 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -292,18 +292,36 @@ static bool findConfiguration(const string &file, const vector<string> &paths) { f = mergeConfig(FTL_GLOBAL_CONFIG_ROOT "/config.json"); found |= f; if (f) LOG(INFO) << "Loaded config: " << FTL_GLOBAL_CONFIG_ROOT "/config.json"; + + f = mergeConfig(FTL_GLOBAL_CONFIG_ROOT "/config.jsonc"); + found |= f; + if (f) LOG(INFO) << "Loaded config: " << FTL_GLOBAL_CONFIG_ROOT "/config.jsonc"; + f = mergeConfig(FTL_LOCAL_CONFIG_ROOT "/config.json"); found |= f; if (f) LOG(INFO) << "Loaded config: " << FTL_LOCAL_CONFIG_ROOT "/config.json"; + + f = mergeConfig(FTL_LOCAL_CONFIG_ROOT "/config.jsonc"); + found |= f; + if (f) LOG(INFO) << "Loaded config: " << FTL_LOCAL_CONFIG_ROOT "/config.jsonc"; + f = mergeConfig("./config.json"); found |= f; if (f) LOG(INFO) << "Loaded config: " << "./config.json"; + + f = mergeConfig("./config.jsonc"); + found |= f; + if (f) LOG(INFO) << "Loaded config: " << "./config.jsonc"; for (auto p : paths) { if (is_directory(p)) { f = mergeConfig(p+"/config.json"); found |= f; if (f) LOG(INFO) << "Loaded config: " << p << "/config.json"; + + f = mergeConfig(p+"/config.jsonc"); + found |= f; + if (f) LOG(INFO) << "Loaded config: " << p << "/config.jsonc"; } } } -- GitLab