fix GitHubClient config

This commit is contained in:
Collin M. Barrett 2019-07-02 12:43:39 -05:00
parent 5dfe568144
commit aef399ef2d
2 changed files with 11 additions and 3 deletions

View file

@ -28,10 +28,10 @@ public static void RegisterAgentServices(this IServiceCollection services)
services.AddSingleton<IFilterListsApiClient, FilterListsApiClient>();
services.AddSingleton<IGitHubClient>(s =>
{
var gitHubConfig = s.GetService<GitHub>();
var client = new GitHubClient(new ProductHeaderValue(gitHubConfig.ProductHeaderValue))
var gitHubConfig = s.GetService<IOptions<GitHub>>();
var client = new GitHubClient(new ProductHeaderValue(gitHubConfig.Value.ProductHeaderValue))
{
Credentials = new Credentials(gitHubConfig.OauthToken)
Credentials = new Credentials(gitHubConfig.Value.OauthToken)
};
return client;
});

View file

@ -4,6 +4,7 @@
using System.Threading.Tasks;
using FilterLists.Agent.Features.Urls.Models.ValidationResults;
using MediatR;
using Octokit;
namespace FilterLists.Agent.Features.Urls
{
@ -21,6 +22,13 @@ public Command(IEnumerable<DataFileUrlValidationResults> dataFileUrlValidationRe
public class Handler : AsyncRequestHandler<Command>
{
private readonly IGitHubClient _gitHubClient;
public Handler(IGitHubClient gitHubClient)
{
_gitHubClient = gitHubClient;
}
protected override async Task Handle(Command request, CancellationToken cancellationToken)
{
throw new NotImplementedException();