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