From 2357c3ffec5c5c700ebc86e5b8305a2137a1e32b Mon Sep 17 00:00:00 2001 From: Emile Date: Sun, 3 Nov 2019 02:04:49 +0100 Subject: starting the http server only if a port is given --- src/http.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/http.go') diff --git a/src/http.go b/src/http.go index 3422992..f2518f6 100644 --- a/src/http.go +++ b/src/http.go @@ -28,13 +28,18 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { // httpStartServer starts the http server func httpStartServer() { - log.Printf("%s Starting the http server", green("[i]")) - // setup the http server and start it - httpServer := setupHTTPServer() - log.Fatalln(httpServer.ListenAndServe()) + if httpServerPort != 8080 { + log.Printf("%s Starting the http server", green("[i]")) - log.Printf("%s Done starting the http server", boldGreen("[+]")) + // setup the http server and start it + httpServer := setupHTTPServer() + log.Fatalln(httpServer.ListenAndServe()) + + log.Printf("%s Done starting the http server", boldGreen("[+]")) + } else { + return + } } // handle requests to the /api/found endpoint -- cgit 1.4.1