-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (32 loc) · 783 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
32
33
34
35
36
37
38
39
package main
import (
"context"
"os"
"github.com/iwanhae/go-statusboard/pkg/config"
"github.com/iwanhae/go-statusboard/pkg/monitor"
"github.com/iwanhae/go-statusboard/pkg/server"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
func main() {
log.Logger = zerolog.
New(os.Stderr).With().
Timestamp().
Caller().
Logger().
Output(zerolog.ConsoleWriter{Out: os.Stderr})
ctx := log.Logger.WithContext(context.Background())
checkList, err := config.LoadConfig("./config.json")
if err != nil {
panic(err)
}
l := monitor.Looker{
CheckList: checkList,
Cache: make([]*monitor.Check, 1000),
}
log.Ctx(ctx).Info().Msg("start monitoring")
l.Start(ctx)
e := server.NewServer(&l)
log.Ctx(ctx).Info().Msg("go-statusboard started")
e.Start(":80")
}