MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / getLocalConfigPath

Function getLocalConfigPath

src/Common/Config/getLocalConfigPath.cpp:12–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10{
11
12std::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}

Callers 1

initializeMethod · 0.85

Calls 3

existsFunction · 0.50
emplace_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected