justlog/main.go

33 lines
822 B
Go
Raw Normal View History

2017-03-04 12:35:53 +01:00
package main
import (
2018-11-29 22:20:57 +01:00
"flag"
2017-09-11 19:51:29 +02:00
2018-12-01 17:46:24 +01:00
"github.com/gempir/justlog/api"
2018-12-06 22:58:42 +01:00
"github.com/gempir/justlog/archiver"
"github.com/gempir/justlog/bot"
2020-03-08 15:22:03 +01:00
"github.com/gempir/justlog/config"
2018-12-01 17:46:24 +01:00
"github.com/gempir/justlog/filelog"
2018-12-02 19:23:54 +01:00
"github.com/gempir/justlog/helix"
2017-03-04 12:35:53 +01:00
)
func main() {
2018-11-29 22:20:57 +01:00
configFile := flag.String("config", "config.json", "json config file")
flag.Parse()
2017-03-04 12:35:53 +01:00
2020-03-08 15:22:03 +01:00
cfg := config.NewConfig(*configFile)
2018-11-29 22:20:57 +01:00
fileLogger := filelog.NewFileLogger(cfg.LogsDirectory)
2020-05-05 22:04:11 +02:00
helixClient := helix.NewClient(cfg.ClientID, cfg.ClientSecret)
2020-05-05 22:45:58 +02:00
go helixClient.StartRefreshTokenRoutine()
2018-12-06 22:58:42 +01:00
archiver := archiver.NewArchiver(cfg.LogsDirectory)
go archiver.Boot()
2018-12-02 14:53:01 +01:00
apiServer := api.NewServer(cfg.LogsDirectory, cfg.ListenAddress, &fileLogger, &helixClient, cfg.Channels)
2018-12-02 14:53:01 +01:00
go apiServer.Init()
bot := bot.NewBot(cfg, &helixClient, &fileLogger)
bot.Connect()
2017-03-04 12:35:53 +01:00
}