Use new projects API
This commit is contained in:
parent
11bca4cf53
commit
8bf483b334
24 changed files with 141 additions and 222 deletions
|
@ -32,7 +32,14 @@ namespace Website
|
|||
});
|
||||
|
||||
services.AddSingleton(Configuration);
|
||||
RegisterRepositories(services);
|
||||
services.AddSingleton<IDatabaseProvider, MySQLDatabaseProvider>()
|
||||
.AddSingleton<UserRepository, UserRepository>();
|
||||
|
||||
services.AddHttpClient<IGitApi, GitApi>(client => client.BaseAddress = new Uri(Configuration["gitApiEndpoint"]))
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler {ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true});
|
||||
|
||||
services.AddHttpClient<IBlogApi, BlogApi>(client => client.BaseAddress = new Uri(Configuration["blogApiEndpoint"]))
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler {ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true});
|
||||
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
||||
|
||||
|
@ -43,16 +50,6 @@ namespace Website
|
|||
;
|
||||
}
|
||||
|
||||
private void RegisterRepositories(IServiceCollection services) =>
|
||||
services.AddSingleton<IDatabaseProvider, MySQLDatabaseProvider>()
|
||||
.AddSingleton<IBlogApi, BlogApi>()
|
||||
.AddSingleton<UserRepository, UserRepository>()
|
||||
.AddSingleton(new GitServerApi(new HttpClient(), Configuration["gitDomain"], Configuration["gitToken"]))
|
||||
.AddHttpClient<IBlogApi, BlogApi>(client => client.BaseAddress = new Uri(Configuration["blogApiEndpoint"]))
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler {
|
||||
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
|
||||
});
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue