diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-25 03:07:05 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-25 03:07:05 +0200 |
commit | f866946fbbe962c712049327ade9dcbd43900295 (patch) | |
tree | 3400fcce20f68a6ef3eb130f4ef57733e346d0e9 /MatrixRoomUtils.Core/Services/ServiceInstaller.cs | |
parent | Working sync (diff) | |
download | MatrixUtils-f866946fbbe962c712049327ade9dcbd43900295.tar.xz |
Working state, refactored Rory&::LibMatrix
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 |