-port flag to override default port

Default port used if none is specified in config
This commit is contained in:
Matthew Holt
2015-04-28 22:13:00 -06:00
parent 0f332bd9fb
commit d00bb87f17
4 changed files with 15 additions and 11 deletions

View File

@ -11,14 +11,17 @@ import (
)
const (
defaultHost = "localhost"
defaultPort = "2015"
defaultRoot = "."
DefaultHost = "localhost"
DefaultPort = "2015"
DefaultRoot = "."
// The default configuration file to load if none is specified
DefaultConfigFile = "Caddyfile"
)
// Port is configurable via command line flag
var Port = DefaultPort
// config represents a server configuration. It
// is populated by parsing a config file (via the
// Load function).
@ -113,9 +116,9 @@ func IsNotFound(err error) bool {
func Default() []Config {
cfg := []Config{
Config{
Root: defaultRoot,
Host: defaultHost,
Port: defaultPort,
Root: DefaultRoot,
Host: DefaultHost,
Port: Port,
},
}
return cfg