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

Function TSPluginInit

plugins/webp_transform/ImageTransform.cc:208–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206};
207
208void
209TSPluginInit(int argc, const char *argv[])
210{
211 if (!RegisterGlobalPlugin("CPP_Webp_Transform", "apache", "dev@trafficserver.apache.org")) {
212 return;
213 }
214
215 if (argc >= 2) {
216 std::string option(argv[1]);
217 if (option.find("convert_to_webp") != std::string::npos) {
218 Dbg(webp_dbg_ctl, "Configured to convert to webp");
219 config_convert_to_webp = true;
220 }
221 if (option.find("convert_to_jpeg") != std::string::npos) {
222 Dbg(webp_dbg_ctl, "Configured to convert to jpeg");
223 config_convert_to_jpeg = true;
224 }
225 if (config_convert_to_webp == false && config_convert_to_jpeg == false) {
226 TSError("Unknown option: %s", option.c_str());
227 }
228 } else {
229 Dbg(webp_dbg_ctl, "Default configuration is to convert both webp and jpeg");
230 config_convert_to_webp = true;
231 config_convert_to_jpeg = true;
232 }
233
234 stat_convert_to_webp.init("plugin." TAG ".convert_to_webp", Stat::SYNC_SUM, false);
235 stat_convert_to_jpeg.init("plugin." TAG ".convert_to_jpeg", Stat::SYNC_SUM, false);
236
237 InitializeMagick("");
238 plugin = new GlobalHookPlugin();
239}

Callers

nothing calls this directly

Calls 5

RegisterGlobalPluginFunction · 0.85
TSErrorFunction · 0.50
findMethod · 0.45
c_strMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected