From 4daca8fd5e56f2ee503fd88bff37551d44c7d688 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Sat, 1 Aug 2020 23:06:34 +0200 Subject: [PATCH] Server is now fully configurable with cli flags --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b0913d3..dba5c1d 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,8 @@ import ( ) var ( - dir = kingpin.Flag("directory", "Path to dir which has to be served.").Required().Short('d').String() + dir = kingpin.Flag("directory", "Path to dir which has to be served.").Required().Short('d').String() + port = kingpin.Flag("port", "Port to run at").Default("8080").String() ) func main() { @@ -13,7 +14,7 @@ func main() { kingpin.Parse() s := Server{ - port: ":8080", + port: ":" + *port, dirPath: *dir, } s.Serve()