mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
cmd: Move module imports into standard packages
This makes it easier to make "standard" caddy builds, since you'll only need to add a single import to get all of Caddy's standard modules. There is a package for all of Caddy's standard modules (modules/standard) and a package for the HTTP app's standard modules only (modules/caddyhttp/standard). We still need to decide which of these, if not all of them, should be kept in the standard build. Those which aren't should be moved out of this repo. See #2780.
This commit is contained in:
parent
27e288ab19
commit
6011ce120a
3 changed files with 49 additions and 25 deletions
|
@ -12,36 +12,25 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
caddycmd "github.com/caddyserver/caddy/v2/cmd"
|
caddycmd "github.com/caddyserver/caddy/v2/cmd"
|
||||||
|
|
||||||
// this is where modules get plugged in
|
// plug in Caddy modules here
|
||||||
_ "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
|
_ "github.com/caddyserver/caddy/v2/modules/standard"
|
||||||
_ "github.com/caddyserver/caddy/v2/caddyconfig/json5"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/caddyconfig/jsonc"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/caddyauth"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/brotli"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/gzip"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/zstd"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/httpcache"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/markdown"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/requestbody"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy/fastcgi"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/starlarkmw"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/templates"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddytls"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddytls/distributedstek"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/caddytls/standardstek"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/filestorage"
|
|
||||||
_ "github.com/caddyserver/caddy/v2/modules/logging"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
21
modules/caddyhttp/standard/imports.go
Normal file
21
modules/caddyhttp/standard/imports.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package standard
|
||||||
|
|
||||||
|
import (
|
||||||
|
// standard Caddy HTTP app modules
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/caddyauth"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/brotli"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/gzip"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/zstd"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/httpcache"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/markdown"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/requestbody"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy/fastcgi"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/starlarkmw"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/templates"
|
||||||
|
)
|
14
modules/standard/import.go
Normal file
14
modules/standard/import.go
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package standard
|
||||||
|
|
||||||
|
import (
|
||||||
|
// standard Caddy modules
|
||||||
|
_ "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/caddyconfig/json5"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/caddyconfig/jsonc"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddyhttp/standard"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddytls"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddytls/distributedstek"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/caddytls/standardstek"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/filestorage"
|
||||||
|
_ "github.com/caddyserver/caddy/v2/modules/logging"
|
||||||
|
)
|
Loading…
Reference in a new issue