forked from trumail/trumail
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
32 lines (24 loc) · 663 Bytes
/
Copy pathmain.go
File metadata and controls
32 lines (24 loc) · 663 Bytes
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
package main
import (
"strings"
"github.com/Sirupsen/logrus"
"github.com/sdwolfe32/trumail/api"
"github.com/sdwolfe32/trumail/config"
)
func main() {
logger := logrus.New() // New Logger
if strings.Contains(config.Env, "prod") {
logger.Formatter = new(logrus.JSONFormatter)
}
l := logger.WithField("port", config.Port)
r, s := api.Initialize(logger)
l.Info("Binding all Trumail endpoints to the router")
api.RegisterEndpoints(r, s)
if config.ServeWeb {
// Set all remaining paths to point to static files (must come after)
r.HandleStatic("./web")
}
// Listen and Serve
l.Info("Listening and Serving")
r.ListenAndServe(config.Port)
}