(ctx caddy.Context)
| 54 | } |
| 55 | |
| 56 | func (p *ImageProxy) Provision(ctx caddy.Context) error { |
| 57 | p.logger = ctx.Logger() |
| 58 | cache, _ := parseCache(p.Cache) |
| 59 | p.proxy = imageproxy.NewProxy(nil, cache) |
| 60 | p.proxy.DefaultBaseURL, _ = url.Parse(p.DefaultBaseURL) |
| 61 | p.proxy.AllowHosts = p.AllowHosts |
| 62 | p.proxy.DenyHosts = p.DenyHosts |
| 63 | p.proxy.Referrers = p.Referrers |
| 64 | p.proxy.ContentTypes = p.ContentTypes |
| 65 | if len(p.proxy.ContentTypes) == 0 { |
| 66 | p.proxy.ContentTypes = []string{"image/*"} |
| 67 | } |
| 68 | for _, key := range p.SignatureKeys { |
| 69 | p.proxy.SignatureKeys = append(p.proxy.SignatureKeys, []byte(key)) |
| 70 | } |
| 71 | p.proxy.Logger = zap.NewStdLog(p.logger) |
| 72 | p.proxy.Verbose = p.Verbose |
| 73 | p.proxy.FollowRedirects = true |
| 74 | return nil |
| 75 | } |
| 76 | |
| 77 | func (p *ImageProxy) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error { |
| 78 | p.proxy.ServeHTTP(w, r) |
nothing calls this directly
no test coverage detected