1
0
Fork 0

Check a passed listen address first.

This commit is contained in:
Alexander Andreev 2022-12-17 21:35:33 +04:00
parent 760d08dcde
commit b793da40d4
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F
1 changed files with 5 additions and 5 deletions

View File

@ -30,11 +30,6 @@ func main() {
return
}
hand := handlers.New(directoryPath, web.Assets(), !*enableFileHandler)
srv := server.NewHttpServer()
srv.GET("/*filepath", hand.Index)
var network string
if !strings.ContainsRune(*listenAddress, ':') {
network = "unix"
@ -52,6 +47,11 @@ func main() {
}
}
hand := handlers.New(directoryPath, web.Assets(), !*enableFileHandler)
srv := server.NewHttpServer()
srv.GET("/*filepath", hand.Index)
if err := srv.Start(network, *listenAddress); err != nil {
log.Fatalln(err)
}