Some checks failed
Release / build-and-push (map[dockerfile:FictionArchive.API/Dockerfile name:api]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.AuthenticationService/Dockerfile name:authentication-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.FileService/Dockerfile name:file-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.NovelService/Dockerfile name:novel-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.SchedulerService/Dockerfile name:scheduler-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.TranslationService/Dockerfile name:translation-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.UserService/Dockerfile name:user-service]) (pull_request) Has been cancelled
Release / build-frontend (pull_request) Has been cancelled
Build Gateway / build-subgraphs (map[name:novel-service project:FictionArchive.Service.NovelService subgraph:Novel]) (pull_request) Failing after 51s
Build Gateway / build-subgraphs (map[name:translation-service project:FictionArchive.Service.TranslationService subgraph:Translation]) (pull_request) Has been cancelled
Build Gateway / build-subgraphs (map[name:user-service project:FictionArchive.Service.UserService subgraph:User]) (pull_request) Has been cancelled
Build Gateway / build-gateway (pull_request) Has been cancelled
Build Gateway / build-subgraphs (map[name:scheduler-service project:FictionArchive.Service.SchedulerService subgraph:Scheduler]) (pull_request) Has been cancelled
CI / build-frontend (pull_request) Has been cancelled
CI / build-backend (pull_request) Has been cancelled
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using FictionArchive.Service.Shared;
|
|
using FictionArchive.Service.Shared.Extensions;
|
|
using FictionArchive.Service.Shared.Services.EventBus.Implementations;
|
|
using FictionArchive.Service.UserService.GraphQL;
|
|
using FictionArchive.Service.UserService.Models.IntegrationEvents;
|
|
using FictionArchive.Service.UserService.Services;
|
|
using FictionArchive.Service.UserService.Services.EventHandlers;
|
|
|
|
namespace FictionArchive.Service.UserService;
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var isSchemaExport = SchemaExportDetector.IsSchemaExportMode(args);
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
#region Event Bus
|
|
|
|
if (!isSchemaExport)
|
|
{
|
|
builder.Services.AddRabbitMQ(opt =>
|
|
{
|
|
builder.Configuration.GetSection("RabbitMQ").Bind(opt);
|
|
})
|
|
.Subscribe<AuthUserAddedEvent, AuthUserAddedEventHandler>();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GraphQL
|
|
|
|
builder.Services.AddDefaultGraphQl<Query, Mutation>();
|
|
|
|
#endregion
|
|
|
|
builder.Services.RegisterDbContext<UserServiceDbContext>(
|
|
builder.Configuration.GetConnectionString("DefaultConnection"),
|
|
skipInfrastructure: isSchemaExport);
|
|
builder.Services.AddTransient<UserManagementService>();
|
|
|
|
builder.Services.AddHealthChecks();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Update database (skip in schema export mode)
|
|
if (!isSchemaExport)
|
|
{
|
|
using var scope = app.Services.CreateScope();
|
|
var dbContext = scope.ServiceProvider.GetRequiredService<UserServiceDbContext>();
|
|
dbContext.UpdateDatabase();
|
|
}
|
|
|
|
app.MapGraphQL();
|
|
|
|
app.MapHealthChecks("/healthz");
|
|
|
|
app.RunWithGraphQLCommands(args);
|
|
}
|
|
} |