♻️ Extract the Storage service to DysonNetwork.Drive microservice
This commit is contained in:
		| @@ -27,6 +27,11 @@ using DysonNetwork.Sphere.Discovery; | ||||
| using DysonNetwork.Sphere.Safety; | ||||
| using DysonNetwork.Sphere.Wallet.PaymentHandlers; | ||||
| using tusdotnet.Stores; | ||||
| using DysonNetwork.Common.Interfaces; | ||||
| using DysonNetwork.Drive.Clients; | ||||
| using DysonNetwork.Sphere.Data; | ||||
| using Npgsql.EntityFrameworkCore.PostgreSQL; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace DysonNetwork.Sphere.Startup; | ||||
|  | ||||
| @@ -36,7 +41,13 @@ public static class ServiceCollectionExtensions | ||||
|     { | ||||
|         services.AddLocalization(options => options.ResourcesPath = "Resources"); | ||||
|  | ||||
|         services.AddDbContext<AppDatabase>(); | ||||
|         services.AddDbContext<AppDatabase>(options => | ||||
|             options.UseNpgsql( | ||||
|                 configuration.GetConnectionString("DefaultConnection"), | ||||
|                 o => o.UseNodaTime() | ||||
|             ) | ||||
|             .UseSnakeCaseNamingConvention() | ||||
|         ); | ||||
|         services.AddSingleton<IConnectionMultiplexer>(_ => | ||||
|         { | ||||
|             var connection = configuration.GetConnectionString("FastRetrieve")!; | ||||
| @@ -49,6 +60,19 @@ public static class ServiceCollectionExtensions | ||||
|         services.AddHttpClient<PassClient>(); | ||||
|         services.AddScoped<PassClient>(); | ||||
|  | ||||
|         // Register HTTP clients for Drive microservice | ||||
|         services.AddHttpClient<IFileServiceClient, FileServiceClient>(client => | ||||
|         { | ||||
|             var baseUrl = configuration["DriveService:BaseUrl"] ?? throw new InvalidOperationException("DriveService:BaseUrl is not configured"); | ||||
|             client.BaseAddress = new Uri(baseUrl); | ||||
|         }); | ||||
|  | ||||
|         services.AddHttpClient<IFileReferenceServiceClient, FileReferenceServiceClient>(client => | ||||
|         { | ||||
|             var baseUrl = configuration["DriveService:BaseUrl"] ?? throw new InvalidOperationException("DriveService:BaseUrl is not configured"); | ||||
|             client.BaseAddress = new Uri(baseUrl); | ||||
|         }); | ||||
|  | ||||
|         // Register OIDC services | ||||
|          | ||||
|  | ||||
| @@ -181,7 +205,6 @@ public static class ServiceCollectionExtensions | ||||
|          | ||||
|          | ||||
|         services.AddScoped<FileService>(); | ||||
|         services.AddScoped<FileReferenceService>(); | ||||
|         services.AddScoped<FileReferenceMigrationService>(); | ||||
|         services.AddScoped<PublisherService>(); | ||||
|         services.AddScoped<PublisherSubscriptionService>(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user