From 3b80462536fb4e299a7ca0b4afceef7b173e5fef Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 16 Feb 2025 15:20:47 +0100 Subject: [PATCH] Made the service provider available by the program class --- app/MindWork AI Studio/Program.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/MindWork AI Studio/Program.cs b/app/MindWork AI Studio/Program.cs index b18bdd1d..5a02e9e4 100644 --- a/app/MindWork AI Studio/Program.cs +++ b/app/MindWork AI Studio/Program.cs @@ -21,6 +21,7 @@ internal sealed class Program public static RustService RUST_SERVICE = null!; public static Encryption ENCRYPTION = null!; public static string API_TOKEN = null!; + public static IServiceProvider SERVICE_PROVIDER = null!; public static async Task Main(string[] args) { @@ -148,6 +149,10 @@ internal sealed class Program var programLogger = app.Services.GetRequiredService>(); programLogger.LogInformation("Starting the AI Studio server."); + // Store the service provider (DI). We need it later for some classes, + // which are not part of the request pipeline: + SERVICE_PROVIDER = app.Services; + // Initialize the encryption service: programLogger.LogInformation("Initializing the encryption service."); var encryptionLogger = app.Services.GetRequiredService>();