diff options
Diffstat (limited to 'MatrixRoomUtils.Core/Services/ServiceInstaller.cs')
-rw-r--r-- | MatrixRoomUtils.Core/Services/ServiceInstaller.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/MatrixRoomUtils.Core/Services/ServiceInstaller.cs b/MatrixRoomUtils.Core/Services/ServiceInstaller.cs index 43255d8..1b275c5 100644 --- a/MatrixRoomUtils.Core/Services/ServiceInstaller.cs +++ b/MatrixRoomUtils.Core/Services/ServiceInstaller.cs @@ -1,16 +1,27 @@ -using MatrixRoomUtils.Core.Interfaces.Services; using Microsoft.Extensions.DependencyInjection; namespace MatrixRoomUtils.Core.Services; public static class ServiceInstaller { - public static IServiceCollection AddRoryLibMatrixServices(this IServiceCollection services) { + public static IServiceCollection AddRoryLibMatrixServices(this IServiceCollection services, RoryLibMatrixConfiguration? config = null) { + //Check required services if (!services.Any(x => x.ServiceType == typeof(TieredStorageService))) throw new Exception("[MRUCore/DI] No TieredStorageService has been registered!"); + //Add config + if(config != null) + services.AddSingleton(config); + else { + services.AddSingleton(new RoryLibMatrixConfiguration()); + } + //Add services services.AddScoped<HomeserverProviderService>(); return services; } +} + +public class RoryLibMatrixConfiguration { + public string AppName { get; set; } = "Rory&::LibMatrix"; } \ No newline at end of file |