-
Notifications
You must be signed in to change notification settings - Fork 15
/
main.go
35 lines (28 loc) · 834 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
package main
import (
"github.com/BurntSushi/toml"
"github.com/maddevsio/comedian/api"
"github.com/maddevsio/comedian/config"
"github.com/maddevsio/comedian/storage"
"github.com/nicksnyder/go-i18n/v2/i18n"
log "github.com/sirupsen/logrus"
"golang.org/x/text/language"
)
func main() {
cnf, err := config.Get()
if err != nil {
log.Fatal("Failed to get config : ", err)
}
db, err := storage.New(cnf.DatabaseURL, "migrations")
if err != nil {
log.Fatal("Failed to connect to db: ", err)
}
bundle := i18n.NewBundle(language.English)
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
bundle.MustLoadMessageFile("active.en.toml")
bundle.MustLoadMessageFile("active.ru.toml")
comedian := api.New(cnf, db, bundle)
if err = comedian.Start(); err != nil {
log.Fatal("Failed to start Comedian API: ", err)
}
}