♻️ No idea, but errors all gone
This commit is contained in:
@@ -2,6 +2,9 @@ using DysonNetwork.Sphere;
|
||||
using DysonNetwork.Sphere.Startup;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using tusdotnet.Stores;
|
||||
using MagicOnion.Client;
|
||||
using DysonNetwork.Shared.Services;
|
||||
using Grpc.Net.Client;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -20,6 +23,42 @@ builder.Services.AddAppSwagger();
|
||||
// Add gRPC services
|
||||
builder.Services.AddGrpc();
|
||||
|
||||
// Configure MagicOnion client for IAccountService
|
||||
builder.Services.AddSingleton<IAccountService>(provider =>
|
||||
{
|
||||
var passServiceUrl = builder.Configuration["PassService:Url"];
|
||||
if (string.IsNullOrEmpty(passServiceUrl))
|
||||
{
|
||||
throw new InvalidOperationException("PassService:Url configuration is missing.");
|
||||
}
|
||||
var channel = GrpcChannel.ForAddress(passServiceUrl);
|
||||
return MagicOnionClient.Create<IAccountService>(channel);
|
||||
});
|
||||
|
||||
// Configure MagicOnion client for IPublisherService
|
||||
builder.Services.AddSingleton<IPublisherService>(provider =>
|
||||
{
|
||||
var passServiceUrl = builder.Configuration["PassService:Url"];
|
||||
if (string.IsNullOrEmpty(passServiceUrl))
|
||||
{
|
||||
throw new InvalidOperationException("PassService:Url configuration is missing.");
|
||||
}
|
||||
var channel = GrpcChannel.ForAddress(passServiceUrl);
|
||||
return MagicOnionClient.Create<IPublisherService>(channel);
|
||||
});
|
||||
|
||||
// Configure MagicOnion client for ICustomAppService
|
||||
builder.Services.AddSingleton<ICustomAppService>(provider =>
|
||||
{
|
||||
var passServiceUrl = builder.Configuration["PassService:Url"];
|
||||
if (string.IsNullOrEmpty(passServiceUrl))
|
||||
{
|
||||
throw new InvalidOperationException("PassService:Url configuration is missing.");
|
||||
}
|
||||
var channel = GrpcChannel.ForAddress(passServiceUrl);
|
||||
return MagicOnionClient.Create<ICustomAppService>(channel);
|
||||
});
|
||||
|
||||
// Add file storage
|
||||
builder.Services.AddAppFileStorage(builder.Configuration);
|
||||
|
||||
@@ -47,8 +86,8 @@ var tusDiskStore = app.Services.GetRequiredService<TusDiskStore>();
|
||||
// Configure application middleware pipeline
|
||||
app.ConfigureAppMiddleware(builder.Configuration, tusDiskStore);
|
||||
|
||||
// Map gRPC services
|
||||
app.MapGrpcService<DysonNetwork.Pass.Auth.AuthGrpcService>();
|
||||
app.MapGrpcService<DysonNetwork.Pass.Account.AccountGrpcService>();
|
||||
// Remove direct gRPC service mappings for Pass services
|
||||
// app.MapGrpcService<DysonNetwork.Pass.Auth.AuthGrpcService>();
|
||||
// app.MapGrpcService<DysonNetwork.Pass.Account.AccountGrpcService>();
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user