about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-11-03 02:04:49 +0100
committerEmile <hanemile@protonmail.com>2019-11-03 02:04:49 +0100
commit2357c3ffec5c5c700ebc86e5b8305a2137a1e32b (patch)
treea37a43cd9a2f3de2270183269298b8b37b869f02
parentd5446ae044a0f240d2aca8c29af26ac20eb738b1 (diff)
starting the http server only if a port is given
-rw-r--r--src/http.go15
1 files changed, 10 insertions, 5 deletions
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