MCPcopy Create free account
hub / github.com/apache/trafficserver / runroot_handler

Function runroot_handler

src/tscore/runroot.cc:175–212  ·  view source on GitHub ↗

handler for ts runroot this function set up runroot_file

Source from the content-addressed store, hash-verified

173// handler for ts runroot
174// this function set up runroot_file
175void
176runroot_handler(const char **argv, bool json)
177{
178 std::string prefix = "--run-root";
179 std::string path;
180
181 // check if we have --run-root...
182 std::string arg = {};
183
184 int i = 0;
185 while (argv[i]) {
186 std::string_view command = argv[i];
187 if (command.substr(0, prefix.size()) == prefix) {
188 arg = command.data();
189 break;
190 }
191 i++;
192 }
193
194 // if --run-root is provided
195 if (!arg.empty() && arg != prefix) {
196 // 1. pass in path
197 prefix += "=";
198 std::string value = arg.substr(prefix.size(), arg.size() - 1);
199 path = get_yaml_path(value);
200 if (!path.empty()) {
201 if (!json) {
202 ink_notice("using command line path as RUNROOT");
203 }
204 runroot_file = path;
205 return;
206 } else if (!json) {
207 ink_warning("Unable to access runroot: '%s'", value.c_str());
208 }
209 }
210
211 runroot_extra_handling(argv[0], json);
212}
213
214// return a map of all path with default layout
215std::unordered_map<std::string, std::string>

Callers 5

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 9

get_yaml_pathFunction · 0.85
ink_noticeFunction · 0.85
ink_warningFunction · 0.85
runroot_extra_handlingFunction · 0.85
substrMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected