This commit is contained in:
zhshch2002 2020-03-30 09:48:00 +08:00
parent b59600db41
commit 807c7253c2
4 changed files with 822 additions and 65 deletions

39
caddy/main.go Normal file
View File

@ -0,0 +1,39 @@
// Copyright 2015 Matthew Holt and The Caddy Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package main is the entry point of the Caddy application.
// Most of Caddy's functionality is provided through modules,
// which can be plugged in by adding their import below.
//
// There is no need to modify the Caddy source code to customize your
// builds. You can easily build a custom Caddy with these simple steps:
//
// 1. Copy this file (main.go) into a new folder
// 2. Edit the imports below to include the modules you want plugged in
// 3. Run `go mod init caddy`
// 4. Run `go install` or `go build` - you now have a custom binary!
//
package main
import (
caddycmd "github.com/caddyserver/caddy/v2/cmd"
// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/zhshch2002/caddy-webp"
)
func main() {
caddycmd.Main()
}

View File

@ -36,7 +36,7 @@ type Webp struct {
func (Webp) CaddyModule() caddy.ModuleInfo { func (Webp) CaddyModule() caddy.ModuleInfo {
return caddy.ModuleInfo{ return caddy.ModuleInfo{
Name: "http.handlers.webp", ID: "http.handlers.webp",
New: func() caddy.Module { return new(Webp) }, New: func() caddy.Module { return new(Webp) },
} }
} }

4
go.mod
View File

@ -3,8 +3,8 @@ module github.com/zhshch2002/caddy-webp
go 1.14 go 1.14
require ( require (
github.com/caddyserver/caddy/v2 v2.0.0-beta9 // indirect github.com/caddyserver/caddy/v2 v2.0.0-beta9.0.20200329195300-deba26d225c5
github.com/chai2010/webp v1.1.1-0.20200323094621-c9e2c1a9877a github.com/chai2010/webp v1.1.1-0.20200323094621-c9e2c1a9877a
github.com/sirupsen/logrus v1.4.2
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 golang.org/x/image v0.0.0-20200119044424-58c23975cae1
golang.org/x/sys v0.0.0-20200327173247-9dae0f8f5775 // indirect
) )

840
go.sum

File diff suppressed because it is too large Load Diff