| 206 | }; |
| 207 | |
| 208 | void |
| 209 | TSPluginInit(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 | } |
nothing calls this directly
no test coverage detected