-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
31 lines (28 loc) · 768 Bytes
/
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
package main
import (
"flag"
"github.com/pthethanh/robusta/internal/app/api"
"github.com/pthethanh/robusta/internal/pkg/config/envconfig"
"github.com/pthethanh/robusta/internal/pkg/http/server"
"github.com/pthethanh/robusta/internal/pkg/log"
)
func main() {
env := flag.String("env", "", "env file")
flag.Parse()
if *env != "" {
if err := envconfig.SetEnvFromFile(*env); err != nil {
log.Panicf("failed to set env, err: %v", err)
}
}
log.Init(log.Fields{
"service": "robusta",
})
log.Infof("initializing HTTP routing...")
router, closer, err := api.NewRouter()
if err != nil {
log.Panicf("failed to init routing, err: %v", err)
}
defer closer.Close()
serverConf := server.LoadConfigFromEnv()
server.ListenAndServe(serverConf, router)
}