Config dump

This commit is contained in:
Ben Sarmiento
2024-04-26 15:00:22 +02:00
parent 755b50c82f
commit 2dbabd3ead
4 changed files with 80 additions and 40 deletions

View File

@@ -47,27 +47,43 @@ func MainApp(configPath string) {
apiClient := http.NewHTTPClient(
config.GetToken(),
config.GetRetriesUntilFailed()*10,
config.GetApiTimeoutSecs(),
false,
config.GetRetriesUntilFailed()*10, // default retries = 2, so this is 20
config.GetApiTimeoutSecs(), // default api timeout = 60
false, // ipv6 support is not needed for api client
config,
log.Named("api_client"),
)
unrestrictClient := http.NewHTTPClient(
config.GetToken(),
config.GetRetriesUntilFailed(),
config.GetDownloadTimeoutSecs(),
false,
config.GetRetriesUntilFailed(), // default retries = 2
config.GetDownloadTimeoutSecs(), // default download timeout = 10
false, // this is also api client, so no ipv6 support
config,
log.Named("unrestrict_client"),
)
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetDownloadTimeoutSecs(), true, config, log.Named("download_client"))
downloadClient := http.NewHTTPClient(
"",
config.GetRetriesUntilFailed(),
config.GetDownloadTimeoutSecs(),
true,
config,
log.Named("download_client"),
)
api := realdebrid.NewRealDebrid(apiClient, unrestrictClient, downloadClient, config, log.Named("realdebrid"))
api := realdebrid.NewRealDebrid(
apiClient,
unrestrictClient,
downloadClient,
config,
log.Named("realdebrid"),
)
premium.MonitorPremiumStatus(api, zurglog)
premium.MonitorPremiumStatus(
api,
zurglog,
)
workerPool, err := ants.NewPool(config.GetNumOfWorkers())
if err != nil {
@@ -77,12 +93,25 @@ func MainApp(configPath string) {
defer workerPool.Release()
utils.EnsureDirExists("data") // Ensure the data directory exists
torrentMgr := torrent.NewTorrentManager(config, api, workerPool, log.Named("manager"))
torrentMgr := torrent.NewTorrentManager(
config,
api,
workerPool,
log.Named("manager"),
)
downloader := universal.NewDownloader(downloadClient)
router := chi.NewRouter()
handlers.AttachHandlers(router, downloader, torrentMgr, config, api, workerPool, log.Named("router"))
handlers.AttachHandlers(
router,
downloader,
torrentMgr,
config,
api,
workerPool,
log.Named("router"),
)
// go func() {
// if err := netHttp.ListenAndServe(":6060", nil); err != nil && err != netHttp.ErrServerClosed {