mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
Feature: Tail live logs (#27)
* chore: add new yarn.lock * chore: add pkgs * feat: push events via server-sent-events * feat(web): tail live logs * fix: update irc network * fix: set baseurl * fix: headers
This commit is contained in:
parent
11fcf1ead9
commit
09eb0b1716
14 changed files with 213 additions and 26 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/r3labs/sse/v2"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/pflag"
|
||||
_ "modernc.org/sqlite"
|
||||
|
@ -40,8 +41,14 @@ func main() {
|
|||
// read config
|
||||
cfg = config.Read(configPath)
|
||||
|
||||
// setup server-sent-events
|
||||
serverEvents := sse.New()
|
||||
serverEvents.AutoReplay = false
|
||||
|
||||
serverEvents.CreateStream("logs")
|
||||
|
||||
// setup logger
|
||||
logger.Setup(cfg)
|
||||
logger.Setup(cfg, serverEvents)
|
||||
|
||||
// if configPath is set then put database inside that path, otherwise create wherever it's run
|
||||
var dataSource = database.DataSourceName(configPath, "autobrr.db")
|
||||
|
@ -85,7 +92,7 @@ func main() {
|
|||
errorChannel := make(chan error)
|
||||
|
||||
go func() {
|
||||
httpServer := http.NewServer(addr, cfg.BaseURL, actionService, authService, downloadClientService, filterService, indexerService, ircService)
|
||||
httpServer := http.NewServer(serverEvents, addr, cfg.BaseURL, actionService, authService, downloadClientService, filterService, indexerService, ircService)
|
||||
errorChannel <- httpServer.Open()
|
||||
}()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue