50 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using DysonNetwork.Ring;
 | |
| using DysonNetwork.Ring.Startup;
 | |
| using DysonNetwork.Shared.Auth;
 | |
| using DysonNetwork.Shared.Http;
 | |
| using DysonNetwork.Shared.Registry;
 | |
| using Microsoft.EntityFrameworkCore;
 | |
| 
 | |
| var builder = WebApplication.CreateBuilder(args);
 | |
| 
 | |
| builder.AddServiceDefaults();
 | |
| 
 | |
| // Configure Kestrel and server options
 | |
| builder.ConfigureAppKestrel(builder.Configuration);
 | |
| 
 | |
| // Add application services
 | |
| builder.Services.AddAppServices(builder.Configuration);
 | |
| builder.Services.AddAppAuthentication();
 | |
| builder.Services.AddDysonAuth();
 | |
| builder.Services.AddAccountService();
 | |
| 
 | |
| builder.Services.AddAppFlushHandlers();
 | |
| builder.Services.AddAppBusinessServices();
 | |
| builder.Services.AddAppScheduledJobs();
 | |
| 
 | |
| builder.AddSwaggerManifest(
 | |
|     "DysonNetwork.Ring",
 | |
|     "The realtime service in the Solar Network."
 | |
| );
 | |
| 
 | |
| var app = builder.Build();
 | |
| 
 | |
| app.MapDefaultEndpoints();
 | |
| 
 | |
| // Run database migrations
 | |
| using (var scope = app.Services.CreateScope())
 | |
| {
 | |
|     var db = scope.ServiceProvider.GetRequiredService<AppDatabase>();
 | |
|     await db.Database.MigrateAsync();
 | |
| }
 | |
| 
 | |
| // Configure application middleware pipeline
 | |
| app.ConfigureAppMiddleware(builder.Configuration);
 | |
| 
 | |
| // Configure gRPC
 | |
| app.ConfigureGrpcServices();
 | |
| 
 | |
| app.UseSwaggerManifest("DysonNetwork.Ring");
 | |
| 
 | |
| app.Run();
 |