-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
49 lines (40 loc) · 1.21 KB
/
main.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
40
41
42
43
44
45
46
47
48
49
package main
import (
"flag"
"os"
"github.com/BaristaVentures/errand-boy/config"
"github.com/BaristaVentures/errand-boy/server"
log "github.com/Sirupsen/logrus"
)
func init() {
// Log as JSON instead of the default ASCII formatter.
// use this to use the json format and it help the integration with 3rd parties
// log.SetFormatter(&log.JSONFormatter{})
// we can also add hooks to send info to papertrail
// package for papertrail hook https://github.com/polds/logrus-papertrail-hook
// Output to stderr instead of stdout, could also be a file.
log.SetOutput(os.Stderr)
// Log info and higher we can change this to use warn and above on prod
log.SetLevel(log.InfoLevel)
}
func main() {
port := flag.Int("p", 8080, "The `port` where Errand Boy will run. Default: 8080")
configFilePath := flag.String(
"c",
"./eb.conf.json",
"The path to Errand Boy's `config file`. Default: ./eb.conf.json",
)
flag.Parse()
log.WithFields(log.Fields{
"path": *configFilePath,
}).Info("Reading Errand Boy config")
_, err := config.Load(*configFilePath)
if err != nil {
panic(err)
}
s := server.Server{Port: *port}
log.WithFields(log.Fields{
"port": s.Port,
}).Info("Errand Boy is ready to go on")
s.BootUp()
}