diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2022-09-15 23:10:16 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2022-09-15 23:10:16 -0600 |
commit | b6cec3789342c2408d878359d4ed07e3789611ac (patch) | |
tree | b1d9c1a5c783f0e7c97427d9b3770fae60fce7d1 /modules/caddyhttp/reverseproxy | |
parent | 48d723c07c52d76755ee323581a20777699f1557 (diff) |
caddyhttp: Add --debug flag to commands
file-server and reverse-proxy
This might be useful!
Diffstat (limited to 'modules/caddyhttp/reverseproxy')
-rw-r--r-- | modules/caddyhttp/reverseproxy/command.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/caddyhttp/reverseproxy/command.go b/modules/caddyhttp/reverseproxy/command.go index ff19919..481f6e0 100644 --- a/modules/caddyhttp/reverseproxy/command.go +++ b/modules/caddyhttp/reverseproxy/command.go @@ -28,6 +28,7 @@ import ( "github.com/caddyserver/caddy/v2/modules/caddyhttp" "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers" "github.com/caddyserver/caddy/v2/modules/caddytls" + "go.uber.org/zap" ) func init() { @@ -62,6 +63,7 @@ default, all incoming headers are passed through unmodified.) fs.Bool("change-host-header", false, "Set upstream Host header to address of upstream") fs.Bool("insecure", false, "Disable TLS verification (WARNING: DISABLES SECURITY BY NOT VERIFYING SSL CERTIFICATES!)") fs.Bool("internal-certs", false, "Use internal CA for issuing certs") + fs.Bool("debug", false, "Enable verbose debug logs") return fs }(), }) @@ -74,6 +76,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) { changeHost := fs.Bool("change-host-header") insecure := fs.Bool("insecure") internalCerts := fs.Bool("internal-certs") + debug := fs.Bool("debug") httpPort := strconv.Itoa(caddyhttp.DefaultHTTPPort) httpsPort := strconv.Itoa(caddyhttp.DefaultHTTPSPort) @@ -198,6 +201,14 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) { AppsRaw: appsRaw, } + if debug { + cfg.Logging = &caddy.Logging{ + Logs: map[string]*caddy.CustomLog{ + "default": {Level: zap.DebugLevel.CapitalString()}, + }, + } + } + err = caddy.Run(cfg) if err != nil { return caddy.ExitCodeFailedStartup, err |