Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net - Fix maintenance-middleware DI #815

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions webapi/Extensions/ServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using CopilotChat.WebApi.Auth;
using CopilotChat.WebApi.Models.Storage;
using CopilotChat.WebApi.Options;
using CopilotChat.WebApi.Services;
using CopilotChat.WebApi.Storage;
using CopilotChat.WebApi.Utilities;
using Microsoft.AspNetCore.Authentication;
Expand Down Expand Up @@ -127,6 +128,15 @@ internal static IServiceCollection AddPlugins(this IServiceCollection services,
return services;
}

internal static IServiceCollection AddMaintenanceServices(this IServiceCollection services)
{
// Inject action stub
services.AddSingleton<IReadOnlyList<IMaintenanceAction>>(
sp => (IReadOnlyList<IMaintenanceAction>)Array.Empty<IMaintenanceAction>());

return services;
}

/// <summary>
/// Add CORS settings.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions webapi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static async Task Main(string[] args)

// Add in the rest of the services.
builder.Services
.AddMaintenanceServices()
.AddEndpointsApiExplorer()
.AddSwaggerGen()
.AddCorsPolicy(builder.Configuration)
Expand Down
Loading