From 226ec328ebe19a90e2f734b14da3970cc3b4f1b7 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Mon, 27 May 2024 00:23:35 +0300 Subject: [PATCH] Test --- src/BUTR.Site.NexusMods.Server/Startup.cs | 35 ++++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/BUTR.Site.NexusMods.Server/Startup.cs b/src/BUTR.Site.NexusMods.Server/Startup.cs index 7312f823..cb5db7c3 100644 --- a/src/BUTR.Site.NexusMods.Server/Startup.cs +++ b/src/BUTR.Site.NexusMods.Server/Startup.cs @@ -50,6 +50,7 @@ using System.Text.Json; using System.Text.Json.Serialization; using System.Text.Unicode; +using Serilog; namespace BUTR.Site.NexusMods.Server; @@ -94,7 +95,7 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { - Console.WriteLine("Test1"); + Log.Warning("Test1"); var assemblyName = typeof(Startup).Assembly.GetName(); var userAgent = $"{assemblyName.Name ?? "ERROR"} v{assemblyName.Version?.ToString() ?? "ERROR"} (github.com/BUTR)"; @@ -108,7 +109,7 @@ public void ConfigureServices(IServiceCollection services) var steamAPISection = _configuration.GetSection(SteamAPISectionName); var depotDownloaderSection = _configuration.GetSection(DepotDownloaderSectionName); - Console.WriteLine("Test2"); + Log.Warning("Test2"); services.AddOptions().Configure(opt => Configure(opt)); services.AddValidatedOptions().Bind(connectionStringSection); services.AddValidatedOptionsWithHttp().Bind(crashReporterSection); @@ -120,7 +121,7 @@ public void ConfigureServices(IServiceCollection services) services.AddValidatedOptions().Bind(steamAPISection); services.AddValidatedOptions().Bind(depotDownloaderSection); - Console.WriteLine("Test3"); + Log.Warning("Test3"); services.AddHttpClient(string.Empty).ConfigureHttpClient((_, client) => { client.DefaultRequestHeaders.Add("User-Agent", userAgent); @@ -190,7 +191,7 @@ public void ConfigureServices(IServiceCollection services) client.DefaultRequestHeaders.Add("User-Agent", userAgent); }).AddPolicyHandler(GetRetryPolicy()); - Console.WriteLine("Test4"); + Log.Warning("Test4"); services.AddQuartz(opt => { opt.AddJobListener(sp => sp.GetRequiredService()); @@ -234,22 +235,22 @@ public void ConfigureServices(IServiceCollection services) services.AddMemoryCache(); - Console.WriteLine("Test5"); + Log.Warning("Test5"); var types = typeof(Startup).Assembly.GetTypes().Where(x => x is { IsAbstract: false, BaseType: { IsGenericType: true } }).ToList(); foreach (var type in types.Where(x => x.BaseType!.GetGenericTypeDefinition() == typeof(BaseEntityConfigurationWithTenant<>))) services.TryAddEnumerable(ServiceDescriptor.Scoped(typeof(IEntityConfiguration), type)); foreach (var type in types.Where(x => x.BaseType!.GetGenericTypeDefinition() == typeof(BaseEntityConfiguration<>))) services.TryAddEnumerable(ServiceDescriptor.Scoped(typeof(IEntityConfiguration), type)); - Console.WriteLine("Tes6"); + Log.Warning("Tes6"); services.AddDbContext(ServiceLifetime.Scoped); services.AddDbContextFactory(lifetime: ServiceLifetime.Scoped); services.AddDbContextFactory(lifetime: ServiceLifetime.Scoped); - Console.WriteLine("Test7"); + Log.Warning("Test7"); services.AddNexusModsDefaultServices(); - Console.WriteLine("Test8"); + Log.Warning("Test8"); services.TryAddEnumerable(ServiceDescriptor.Singleton()); services.AddAuthentication(ButrNexusModsAuthSchemeConstants.AuthScheme).AddNexusMods(options => @@ -258,16 +259,16 @@ public void ConfigureServices(IServiceCollection services) options.EncryptionKey = opts?.EncryptionKey ?? string.Empty; }); - Console.WriteLine("Test9"); + Log.Warning("Test9"); services.AddStreamingMultipartResult(); services.AddHttpContextAccessor(); - Console.WriteLine("Test10"); + Log.Warning("Test10"); services.AddRouting(opt => { opt.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer); }); - Console.WriteLine("Test11"); + Log.Warning("Test11"); services.AddControllersWithAPIResult(opt => { opt.Conventions.Add(new SlugifyActionConvention()); @@ -277,7 +278,7 @@ public void ConfigureServices(IServiceCollection services) opt.ValueProviderFactories.Add(new ClaimsValueProviderFactory()); }).AddJsonOptions(opt => Configure(opt.JsonSerializerOptions)); - Console.WriteLine("Test12"); + Log.Warning("Test12"); services.AddResponseCompression(opt => { opt.Providers.Add(); @@ -292,7 +293,7 @@ public void ConfigureServices(IServiceCollection services) options.Level = CompressionLevel.SmallestSize; }); - Console.WriteLine("Test13"); + Log.Warning("Test13"); services.AddSwaggerGen(opt => { opt.SwaggerDoc("v1", new OpenApiInfo @@ -345,10 +346,10 @@ public void ConfigureServices(IServiceCollection services) .Where(File.Exists) .ToList(); foreach (var xmlFilePath in xmlFilePaths) - opt.IncludeXmlComments(xmlFilePath, true); + opt.IncludeXmlComments(xmlFilePath); }); - Console.WriteLine("Test14"); + Log.Warning("Test14"); services.Configure(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; @@ -356,7 +357,7 @@ public void ConfigureServices(IServiceCollection services) services.AddResponseCaching(); - Console.WriteLine("Test15"); + Log.Warning("Test15"); services.AddCors(options => { options.AddPolicy("Development", builder => builder @@ -366,7 +367,7 @@ public void ConfigureServices(IServiceCollection services) ); }); - Console.WriteLine("Test16"); + Log.Warning("Test16"); services.AddDistributedPostgreSqlCache(options => { var opts = connectionStringSection.Get();