feat: passing of the port as arg
This commit is contained in:
parent
2cb3cc7c35
commit
f48d958a2c
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
|
@ -66,6 +67,11 @@ func main() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
log.Print("starting server on default :8080")
|
var port int
|
||||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
flag.IntVar(&port, "p", 8080, "Specify port for server to start on")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
address := fmt.Sprintf("localhost:%d", port)
|
||||||
|
log.Printf("starting server on %s", address)
|
||||||
|
log.Fatal(http.ListenAndServe(address, nil))
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue