forked from matthieudolci/hatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (34 loc) · 780 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
package main
import (
"context"
"net/http"
"github.com/matthieudolci/hatcher/common"
_ "expvar"
_ "net/http/pprof"
log "github.com/Sirupsen/logrus"
"github.com/matthieudolci/hatcher/api"
"github.com/matthieudolci/hatcher/bot"
"github.com/matthieudolci/hatcher/database"
"github.com/matthieudolci/hatcher/scheduler"
)
func main() {
var s *common.Slack
database.InitDb()
defer database.DB.Close()
ctx := context.Background()
s, err := bot.New()
if err != nil {
log.Fatal(err)
}
if err := bot.Run(ctx, s); err != nil {
log.Fatal(err)
}
if err := scheduler.GetTimeAndUsersForScheduler(s); err != nil {
log.WithError(err)
}
handler, err := api.Handler(s)
if err != nil {
log.Fatal(err)
}
log.Fatal(http.ListenAndServe(":9191", handler))
}