| 10 | { |
| 11 | |
| 12 | std::optional<std::string> getLocalConfigPath(const std::string & home_path) |
| 13 | { |
| 14 | std::string config_path; |
| 15 | |
| 16 | std::vector<std::string> names; |
| 17 | names.emplace_back("./clickhouse-local"); |
| 18 | if (!home_path.empty()) |
| 19 | names.emplace_back(home_path + "/.clickhouse-local/config"); |
| 20 | names.emplace_back("/etc/clickhouse-local/config"); |
| 21 | |
| 22 | for (const auto & name : names) |
| 23 | { |
| 24 | for (const auto & extension : {".xml", ".yaml", ".yml"}) |
| 25 | { |
| 26 | config_path = name + extension; |
| 27 | |
| 28 | std::error_code ec; |
| 29 | if (fs::exists(config_path, ec)) |
| 30 | return config_path; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | return std::nullopt; |
| 35 | } |
| 36 | |
| 37 | } |
no test coverage detected