-
Notifications
You must be signed in to change notification settings - Fork 1
/
office-mapper.go
39 lines (34 loc) · 1003 Bytes
/
office-mapper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"github.com/gorilla/context"
"log"
"net/http"
"office-mapper/config"
"office-mapper/handlers"
"office-mapper/panichandler"
"ooyala/go-ooyala-headers"
"ooyala/go-ooyalalog"
"os"
"runtime"
"time"
)
func main() {
ncpu := runtime.NumCPU()
log.Println("Starting app with GOMAXPROCS = ", ncpu)
runtime.GOMAXPROCS(ncpu)
// Build the stack of handlers
appHandlers := handlers.AppHandlers()
panicHandler := panichandler.NewHandler(appHandlers)
timeoutHandler := http.TimeoutHandler(panicHandler, 60*time.Second, "Request Timed Out")
ooyalaHeaderHandler := ooheaders.NewHandler(timeoutHandler)
logHandler := ooyalalog.NewHandler(ooyalaHeaderHandler, os.Stdout, []string{"/healthz"})
clearContextHandler := context.ClearHandler(logHandler)
addr := fmt.Sprintf(":%d", config.Settings.HTTPPort)
server := &http.Server{
Addr: addr,
Handler: clearContextHandler,
}
log.Println("Now listening on " + addr)
log.Fatalf(server.ListenAndServe().Error())
}