fixes here and there

This commit is contained in:
Ben Sarmiento
2023-11-11 02:34:46 +01:00
parent 147c0bd444
commit cd96c7bd38
14 changed files with 181 additions and 155 deletions

View File

@@ -13,31 +13,23 @@ import (
"github.com/debridmediamanager.com/zurg/internal/net"
"github.com/debridmediamanager.com/zurg/internal/torrent"
"github.com/debridmediamanager.com/zurg/pkg/logutil"
"github.com/debridmediamanager.com/zurg/pkg/realdebrid"
"github.com/hashicorp/golang-lru/v2/expirable"
"github.com/nutsdb/nutsdb"
)
func main() {
rlog := logutil.NewLogger()
log := rlog.Named("zurg")
log := logutil.NewLogger().Named("zurg")
config, configErr := config.LoadZurgConfig("./config.yml")
if configErr != nil {
log.Panicf("Config failed to load: %v", configErr)
}
db, err := nutsdb.Open(
nutsdb.DefaultOptions,
nutsdb.WithDir("/tmp/nutsdb"),
)
if err != nil {
log.Fatal(err)
}
defer db.Close()
cache := expirable.NewLRU[string, string](1e4, nil, time.Hour)
torrentMgr := torrent.NewTorrentManager(config, db)
rd := realdebrid.NewRealDebrid(config.GetToken(), config, logutil.NewLogger().Named("realdebrid"))
torrentMgr := torrent.NewTorrentManager(config, rd)
mux := http.NewServeMux()
net.Router(mux, config, torrentMgr, cache)