@marcel91200 / caddy Mirror · read-only / commits / 6011ce12
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

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.

Matthew Holt committed Nov 4, 2019 at 12:13 UTC 6011ce120a4b2df9314a800fc93a61f852b766c1
3 files changed +49 -25
cmd/caddy/main.go
+14 -25
@@ -12,36 +12,25 @@
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 +// Package main is the entry point of the Caddy application.
16 +// Most of Caddy's functionality is provided through modules,
17 +// which can be plugged in by adding their import below.
18 +//
19 +// There is no need to modify the Caddy source code to customize your
20 +// builds. You can easily build a custom Caddy with these simple steps:
21 +//
22 +// 1. Copy this file (main.go) into a new folder
23 +// 2. Edit the imports below to include the modules you want plugged in
24 +// 3. Run `go mod init caddy`
25 +// 4. Run `go install` or `go build` - you now have a custom binary!
26 +//
27 package main
28
29 import (
30 caddycmd "github.com/caddyserver/caddy/v2/cmd"
31
20 - // this is where modules get plugged in
21 - _ "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
22 - _ "github.com/caddyserver/caddy/v2/caddyconfig/json5"
23 - _ "github.com/caddyserver/caddy/v2/caddyconfig/jsonc"
24 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp"
25 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/caddyauth"
26 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
27 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/brotli"
28 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/gzip"
29 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/zstd"
30 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver"
31 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
32 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/httpcache"
33 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/markdown"
34 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/requestbody"
35 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy"
36 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy/fastcgi"
37 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite"
38 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/starlarkmw"
39 - _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/templates"
40 - _ "github.com/caddyserver/caddy/v2/modules/caddytls"
41 - _ "github.com/caddyserver/caddy/v2/modules/caddytls/distributedstek"
42 - _ "github.com/caddyserver/caddy/v2/modules/caddytls/standardstek"
43 - _ "github.com/caddyserver/caddy/v2/modules/filestorage"
44 - _ "github.com/caddyserver/caddy/v2/modules/logging"
32 + // plug in Caddy modules here
33 + _ "github.com/caddyserver/caddy/v2/modules/standard"
34 )
35
36 func main() {
modules/caddyhttp/standard/imports.go new
+21
@@ -0,0 +1,21 @@
1 +package standard
2 +
3 +import (
4 + // standard Caddy HTTP app modules
5 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp"
6 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/caddyauth"
7 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
8 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/brotli"
9 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/gzip"
10 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode/zstd"
11 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver"
12 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
13 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/httpcache"
14 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/markdown"
15 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/requestbody"
16 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy"
17 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy/fastcgi"
18 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite"
19 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/starlarkmw"
20 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/templates"
21 +)
modules/standard/import.go new
+14
@@ -0,0 +1,14 @@
1 +package standard
2 +
3 +import (
4 + // standard Caddy modules
5 + _ "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
6 + _ "github.com/caddyserver/caddy/v2/caddyconfig/json5"
7 + _ "github.com/caddyserver/caddy/v2/caddyconfig/jsonc"
8 + _ "github.com/caddyserver/caddy/v2/modules/caddyhttp/standard"
9 + _ "github.com/caddyserver/caddy/v2/modules/caddytls"
10 + _ "github.com/caddyserver/caddy/v2/modules/caddytls/distributedstek"
11 + _ "github.com/caddyserver/caddy/v2/modules/caddytls/standardstek"
12 + _ "github.com/caddyserver/caddy/v2/modules/filestorage"
13 + _ "github.com/caddyserver/caddy/v2/modules/logging"
14 +)