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

Function amend_variable_name

src/traffic_ctl/FileConfigCommand.cc:42–56  ·  view source on GitHub ↗

We support either passing variables with the prefix 'proxy.config.' or 'records.' Internally we need to use 'records.variable' as the root node starts with 'records' for records configs.

Source from the content-addressed store, hash-verified

40/// Internally we need to use 'records.variable' as the root node starts with 'records' for records
41/// configs.
42std::string
43amend_variable_name(swoc::TextView variable)
44{
45 std::string var{TS_PREFIX};
46 // If the variable is prefixed with "proxy.config" we will remove it and replace it
47 // with the records "records." root name.
48 if (swoc::TextView{variable}.starts_with(PREFIX)) {
49 var += variable.substr(PREFIX.size());
50 return var;
51 }
52
53 // you may be using "records." already or some other name maybe for a different file.
54 // we expect either `ts` or `proxy.config`
55 return {variable.data(), variable.size()};
56}
57
58/// traffic_ctl should work without the need to pass the filename, so use the data
59/// we have to figure out the file path. If the filename is specified in the traffic_ctl

Callers 2

config_getMethod · 0.85
config_setMethod · 0.85

Calls 4

starts_withMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected