From 28252bcb560b44251aa53b97680b5e664a6d7c2c Mon Sep 17 00:00:00 2001 From: Glenn Wilkinson Date: Tue, 29 Oct 2019 02:38:59 +0000 Subject: [PATCH] Will exit on port binding failure (#1635) --- controllers/phish.go | 7 +++---- controllers/route.go | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/controllers/phish.go b/controllers/phish.go index bb084c15..0d9fc262 100644 --- a/controllers/phish.go +++ b/controllers/phish.go @@ -82,19 +82,18 @@ func WithContactAddress(addr string) PhishingServerOption { } // Start launches the phishing server, listening on the configured address. -func (ps *PhishingServer) Start() error { +func (ps *PhishingServer) Start() { if ps.config.UseTLS { err := util.CheckAndCreateSSL(ps.config.CertPath, ps.config.KeyPath) if err != nil { log.Fatal(err) - return err } log.Infof("Starting phishing server at https://%s", ps.config.ListenURL) - return ps.server.ListenAndServeTLS(ps.config.CertPath, ps.config.KeyPath) + log.Fatal(ps.server.ListenAndServeTLS(ps.config.CertPath, ps.config.KeyPath)) } // If TLS isn't configured, just listen on HTTP log.Infof("Starting phishing server at http://%s", ps.config.ListenURL) - return ps.server.ListenAndServe() + log.Fatal(ps.server.ListenAndServe()) } // Shutdown attempts to gracefully shutdown the server. diff --git a/controllers/route.go b/controllers/route.go index 2b01e058..72cf545d 100644 --- a/controllers/route.go +++ b/controllers/route.go @@ -65,7 +65,7 @@ func NewAdminServer(config config.AdminServer, options ...AdminServerOption) *Ad } // Start launches the admin server, listening on the configured address. -func (as *AdminServer) Start() error { +func (as *AdminServer) Start() { if as.worker != nil { go as.worker.Start() } @@ -73,14 +73,13 @@ func (as *AdminServer) Start() error { err := util.CheckAndCreateSSL(as.config.CertPath, as.config.KeyPath) if err != nil { log.Fatal(err) - return err } log.Infof("Starting admin server at https://%s", as.config.ListenURL) - return as.server.ListenAndServeTLS(as.config.CertPath, as.config.KeyPath) + log.Fatal(as.server.ListenAndServeTLS(as.config.CertPath, as.config.KeyPath)) } // If TLS isn't configured, just listen on HTTP log.Infof("Starting admin server at http://%s", as.config.ListenURL) - return as.server.ListenAndServe() + log.Fatal(as.server.ListenAndServe()) } // Shutdown attempts to gracefully shutdown the server.