You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
916 B
29 lines
916 B
using System.IO.Abstractions;
|
|
using Recyclarr.Common.Extensions;
|
|
using Recyclarr.TrashLib.Settings;
|
|
using Recyclarr.TrashLib.Startup;
|
|
using Serilog.Context;
|
|
|
|
namespace Recyclarr.TrashLib.Repo;
|
|
|
|
public class ConfigTemplatesRepo : IConfigTemplatesRepo, IUpdateableRepo
|
|
{
|
|
private readonly IRepoUpdater _repoUpdater;
|
|
private readonly ISettingsProvider _settings;
|
|
|
|
public ConfigTemplatesRepo(IRepoUpdater repoUpdater, IAppPaths paths, ISettingsProvider settings)
|
|
{
|
|
_repoUpdater = repoUpdater;
|
|
_settings = settings;
|
|
Path = paths.ReposDirectory.SubDir("config-templates");
|
|
}
|
|
|
|
public IDirectoryInfo Path { get; }
|
|
|
|
public Task Update(CancellationToken token)
|
|
{
|
|
using var logScope = LogContext.PushProperty(LogProperty.Scope, "Config Templates Repo");
|
|
return _repoUpdater.UpdateRepo(Path, _settings.Settings.Repositories.ConfigTemplates, token);
|
|
}
|
|
}
|