diff options
| author | Horus3 | 2015-04-21 07:04:00 +0200 |
|---|---|---|
| committer | Horus3 | 2015-04-21 07:04:00 +0200 |
| commit | 9d86a3c05ec4339da74dae6cc3bf2f91d49f1574 (patch) | |
| tree | be12d7bf0cbe847ed30f177acc48fa9e99bfe1eb /server/server.go | |
| parent | 7e4ccc40be46366fd8c0550aca1bfb6e73c3b5c6 (diff) | |
| download | mandible-9d86a3c05ec4339da74dae6cc3bf2f91d49f1574.tar.gz | |
Add Ip to config.
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) { |
