| 66 | } |
| 67 | |
| 68 | std::optional<std::string> Config::findConfigPath(const std::vector<std::string>& names, |
| 69 | const std::vector<std::string>& dirs) { |
| 70 | if (const char* dir = std::getenv(Config::CONFIG_PATH_ENV)) { |
| 71 | for (const auto& name : names) { |
| 72 | if (auto res = tryExpandPath(dir, name); !res.empty()) { |
| 73 | return res.front(); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | for (const auto& dir : dirs) { |
| 79 | for (const auto& name : names) { |
| 80 | if (auto res = tryExpandPath(dir, name); !res.empty()) { |
| 81 | return res.front(); |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | return std::nullopt; |
| 86 | } |
| 87 | |
| 88 | void Config::setupConfig(Json::Value& dst, const std::string& config_file, int depth) { |
| 89 | if (depth > 100) { |