Listen on both the FCGI port and the webport!

This commit is contained in:
George Shammas 2015-05-15 20:33:27 -04:00
parent ba2b86deb9
commit 6d248b5cf0
2 changed files with 19 additions and 10 deletions

View File

@ -1 +1,3 @@
FROM golang:1.4-onbuild FROM golang:1.4-onbuild
EXPOSE 8080

23
main.go
View File

@ -5,6 +5,7 @@ import (
"net" "net"
"net/http" "net/http"
"net/http/fcgi" "net/http/fcgi"
"os"
"path" "path"
"strings" "strings"
"time" "time"
@ -143,15 +144,21 @@ func main() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
err = fcgi.Serve(fcgi_listen, r) errc := make(chan error)
if err != nil { go func(errc chan error) {
for err := range errc {
panic(err) panic(err)
} }
}(errc)
//port := os.Getenv("PORT") go func(errc chan error) {
//host := os.Getenv("HOST") errc <- fcgi.Serve(fcgi_listen, r)
//if port == "" { }(errc)
// port = "8080"
//} port := os.Getenv("PORT")
//r.Run(host + ":" + port) host := os.Getenv("HOST")
if port == "" {
port = "8080"
}
errc <- r.Run(host + ":" + port)
} }