doomer/main.go

27 lines
377 B
Go
Raw Normal View History

2022-12-04 17:30:08 +03:00
package main
import (
"log"
2022-12-06 00:57:09 +03:00
"nefrace.ru/doomer/config"
2022-12-04 17:30:08 +03:00
)
func main() {
2022-12-06 00:57:09 +03:00
cfg := config.InitConfig()
2022-12-04 17:30:08 +03:00
db, err := NewDatabase()
if err != nil {
log.Fatalf("Cant open database: %v", err)
}
2022-12-06 00:57:09 +03:00
2022-12-04 17:30:08 +03:00
defer db.Close()
2022-12-06 00:57:09 +03:00
doomer := NewDoomer(db)
dp := NewDispatcher(doomer)
2022-12-04 17:30:08 +03:00
server := CreateServer(db)
go func() {
2022-12-06 00:57:09 +03:00
log.Fatal(server.Start(cfg.Host))
2022-12-04 17:30:08 +03:00
}()
log.Println(dp.Poll())
}