summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorache <ache@ache.one>2021-05-16 04:22:01 +0200
committerache <ache@ache.one>2021-05-16 04:22:01 +0200
commit606beda91c70cafbde5bd93783cb03949ebe0ee3 (patch)
tree9ab3da65a5e79ab83aa73ba04196e98b712c978d /server.go
parentDeal with hostnames (diff)
Force host with cli arg
Diffstat (limited to 'server.go')
-rw-r--r--server.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/server.go b/server.go
index 820a21a..eab1e75 100644
--- a/server.go
+++ b/server.go
@@ -414,6 +414,7 @@ func main() {
var dirRoot string
var help, version bool
var port = -1
+ var host string
helpString := `This is the help`
versionString := "0.0.0"
@@ -425,9 +426,12 @@ func main() {
usageDir = "the directory to serve"
usageHelp = "show some help"
usageVersion = "show the version"
+ usageHost = "select the host adress"
)
flag.StringVar(&dirRoot, "directory", "", usageDir)
- flag.StringVar(&dirRoot, "d", "", usageDir + " (shorthand)")
+ flag.StringVar(&dirRoot, "d", "localhost", usageHost + " (shorthand)")
+ flag.StringVar(&host, "hostname", "", usageHost)
+ flag.StringVar(&host, "H", "", usageHost + " (shorthand)")
flag.IntVar(&port, "port", 0, portUsage)
flag.IntVar(&port, "p", 0, portUsage + " (shorthand)")
flag.BoolVar(&help, "help", false, usageHelp)
@@ -467,6 +471,9 @@ func main() {
dirRoot = defaultRoot
}
}
+ if host != "" {
+ config.Config.Hostnames = []string{host}
+ }
fmap := template.FuncMap{
"formatURL": encodeURL,