summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/fileserver/command.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/caddyhttp/fileserver/command.go b/modules/caddyhttp/fileserver/command.go
index 6a44b3c..654c9b8 100644
--- a/modules/caddyhttp/fileserver/command.go
+++ b/modules/caddyhttp/fileserver/command.go
@@ -33,7 +33,7 @@ func init() {
caddycmd.RegisterCommand(caddycmd.Command{
Name: "file-server",
Func: cmdFileServer,
- Usage: "[--domain <example.com>] [--root <path>] [--listen <addr>] [--browse]",
+ Usage: "[--domain <example.com>] [--root <path>] [--listen <addr>] [--browse] [--access-log]",
Short: "Spins up a production-ready file server",
Long: `
A simple but production-ready file server. Useful for quick deployments,
@@ -55,6 +55,7 @@ respond with a file listing.`,
fs.String("listen", "", "The address to which to bind the listener")
fs.Bool("browse", false, "Enable directory browsing")
fs.Bool("templates", false, "Enable template rendering")
+ fs.Bool("access-log", false, "Enable the access log")
return fs
}(),
})
@@ -68,6 +69,7 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) {
listen := fs.String("listen")
browse := fs.Bool("browse")
templates := fs.Bool("templates")
+ accessLog := fs.Bool("access-log")
var handlers []json.RawMessage
@@ -107,6 +109,9 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) {
}
}
server.Listen = []string{listen}
+ if accessLog {
+ server.Logs = &caddyhttp.ServerLogConfig{}
+ }
httpApp := caddyhttp.App{
Servers: map[string]*caddyhttp.Server{"static": server},