diff options
author | Matthew Holt <[email protected]> | 2019-10-04 17:30:51 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-10-04 17:30:51 -0600 |
commit | 65c060f56e2e2d3a94580d938d8373f736821d83 (patch) | |
tree | d4121b768789821586cbc181a13892a4684bd028 /modules/caddyhttp/fileserver/command.go | |
parent | 44cb804b9e5bc2779cf971862c37a1e3b4671e26 (diff) | |
download | caddy-65c060f56e2e2d3a94580d938d8373f736821d83.tar.gz caddy-65c060f56e2e2d3a94580d938d8373f736821d83.zip |
file_server: Set default address to :2015 if --listen not specified
Diffstat (limited to 'modules/caddyhttp/fileserver/command.go')
-rw-r--r-- | modules/caddyhttp/fileserver/command.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/caddyhttp/fileserver/command.go b/modules/caddyhttp/fileserver/command.go index 727d7baa3..ac580b6a9 100644 --- a/modules/caddyhttp/fileserver/command.go +++ b/modules/caddyhttp/fileserver/command.go @@ -21,6 +21,7 @@ import ( "github.com/caddyserver/caddy/v2" "github.com/caddyserver/caddy/v2/caddyconfig" + "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" caddycmd "github.com/caddyserver/caddy/v2/cmd" "github.com/caddyserver/caddy/v2/modules/caddyhttp" ) @@ -81,9 +82,10 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) { server := &caddyhttp.Server{ Routes: caddyhttp.RouteList{route}, } - if listen != "" { - server.Listen = []string{listen} + if listen == "" { + listen = ":" + httpcaddyfile.DefaultPort } + server.Listen = []string{listen} httpApp := caddyhttp.App{ Servers: map[string]*caddyhttp.Server{"static": server}, @@ -100,7 +102,7 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) { return caddy.ExitCodeFailedStartup, err } - log.Println("Caddy 2 serving static files") + log.Printf("Caddy 2 serving static files on %s", listen) select {} } |