-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
49 lines (33 loc) · 782 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
40
41
42
43
44
45
46
47
48
49
package main
import (
"github.com/gofiber/fiber"
"github.com/juandiii/jetson-monitor/api"
"github.com/juandiii/jetson-monitor/config"
"github.com/juandiii/jetson-monitor/logging"
"github.com/juandiii/jetson-monitor/scheduler"
"github.com/robfig/cron/v3"
)
type Scheduler struct {
cron *cron.Cron
}
func main() {
log := logging.Logger
s := &Scheduler{
cron: cron.New(),
}
config := &config.ConfigJetson{}
config, err := config.LoadConfig()
if err != nil {
panic(err)
}
for _, conf := range config.Urls {
s.cron.AddJob(conf.Scheduler, scheduler.New(conf))
}
s.cron.Start()
app := fiber.New(&fiber.Settings{
DisableStartupMessage: true,
})
api.InitializeRoute(app)
log.Debugf("HTTP start :: listening port: %d", 38080)
app.Listen(38080)
}