diff options
Diffstat (limited to 'server/server.go')
| -rw-r--r-- | server/server.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/server.go b/server/server.go index e55d2e1..37fa8aa 100644 --- a/server/server.go +++ b/server/server.go @@ -68,12 +68,14 @@ func (s *Server) uploadFile(uploadFile io.Reader, w http.ResponseWriter, fileNam processor, err := imageprocessor.Factory(s.Config.MaxFileSize, upload) if err != nil { + log.Println(err) ErrorResponse(w, "Unable to process image!", http.StatusInternalServerError) return } err = processor.Run(upload) if err != nil { + log.Println(err) ErrorResponse(w, "Unable to process image!", http.StatusInternalServerError) return } @@ -233,8 +235,13 @@ func (s *Server) Start() { if port == ":" { port = fmt.Sprintf(":%d", s.Config.Port) } + ip := os.Getenv("IP") + if ip == "" { + ip = fmt.Sprintf("%s", s.Config.Ip) + } - log.Panic(http.ListenAndServe(port, nil)) + fmt.Println("Starting server listening on " + ip + port + ".") + log.Panic(http.ListenAndServe(ip+port, nil)) } func (s *Server) download(url string) (io.ReadCloser, error) { |
