-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (33 loc) · 848 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
package main
import (
"context"
log "github.com/sirupsen/logrus"
)
func main() {
ctx := context.Background()
if err := LoadDotEnv(); err != nil {
log.WithError(err).Fatal("error loading .env file")
}
cfg, err := ReadConfigFromEnv(ctx)
if err != nil {
log.WithError(err).Fatal("error reading config")
}
calSvc := NewCalendarService(cfg)
if err := calSvc.Init(ctx); err != nil {
log.WithError(err).Fatal("error initializing calendar service")
}
telcli := NewTelegram(cfg)
if err := telcli.Init(); err != nil {
log.WithError(err).Fatal("error initializing telegram client")
}
lastChkdDao := NewLastCheckedDao(cfg)
engine := Engine{
cfg: cfg,
calSvc: calSvc,
telcli: telcli,
lastChkdDao: lastChkdDao,
}
if err := engine.Work(ctx); err != nil {
log.WithError(err).Fatal("engine failed")
}
}