Docker Compose bot + Google Api
Build App / Build (push) Failing after 3s

This commit is contained in:
2026-08-06 16:23:50 +02:00
parent c9a3c252e1
commit 937b8554dd
44 changed files with 3360 additions and 74 deletions
+58 -1
View File
@@ -19,6 +19,7 @@ using AutoMapper;
using LaDOSE.Api.Helpers;
using LaDOSE.Business.Helper;
using LaDOSE.Business.Provider.ChallongProvider;
using LaDOSE.Business.Provider.SheetsProvider;
using LaDOSE.Business.Provider.SmashProvider;
using LaDOSE.Entity.Challonge;
using LaDOSE.Entity.Wordpress;
@@ -69,7 +70,11 @@ namespace LaDOSE.Api
}).AddNewtonsoftJson(x =>
{
x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
x.SerializerSettings.MaxDepth= 4;
// MaxDepth governs *reading*, so it caps how deep an inbound body may nest.
// ReferenceLoopHandling above is what tames the outbound Entity graph.
// The Sheets export body is 7 deep (root > tabs > tab > rows > row > points >
// number), so the previous value of 4 rejected it outright.
x.SerializerSettings.MaxDepth = 32;
});
#if DEBUG
services.AddOpenApi();
@@ -162,6 +167,19 @@ namespace LaDOSE.Api
cfg.CreateMap<MatchCoverage, LaDOSE.DTO.MatchCoverageDTO>();
cfg.CreateMap<PlayerMatchStats, LaDOSE.DTO.PlayerMatchStatsDTO>();
cfg.CreateMap<HeadToHead, LaDOSE.DTO.HeadToHeadDTO>();
cfg.CreateMap<PlayerVersus, LaDOSE.DTO.PlayerVersusDTO>();
cfg.CreateMap<VersusGameStats, LaDOSE.DTO.VersusGameStatsDTO>();
cfg.CreateMap<PlayerOption, LaDOSE.DTO.PlayerOptionDTO>();
// Sheets export. Two-way: the request arrives as a DTO and has to become a POCO,
// which plain CreateMap does not give. SheetExportRequest.SpreadsheetId has no DTO
// counterpart on purpose — SheetsExportService fills it from configuration.
cfg.CreateMapTwoWay<SheetExportRequest, LaDOSE.DTO.SheetExportRequestDTO>();
cfg.CreateMapTwoWay<SheetTable, LaDOSE.DTO.SheetTableDTO>();
cfg.CreateMapTwoWay<SheetRow, LaDOSE.DTO.SheetRowDTO>();
cfg.CreateMap<SheetExportResult, LaDOSE.DTO.SheetExportResultDTO>();
cfg.CreateMap<SheetTabResult, LaDOSE.DTO.SheetTabResultDTO>();
cfg.CreateMap<SheetsConfig, LaDOSE.DTO.SheetsConfigDTO>();
});
IMapper mapper = mapperConfig.CreateMapper();
@@ -194,6 +212,45 @@ namespace LaDOSE.Api
this.Configuration["ApiKey:SmashApiKey"]));
services.AddScoped<IExternalProviderService, ExternalProviderService>();
#region Google Sheets export
// Limits and the target spreadsheet. The spreadsheet is reset every year, so it lives
// in configuration rather than in code — see .env.example.
services.AddSingleton(new SheetsSettings
{
SpreadsheetId = this.Configuration["GoogleSheets:SpreadsheetId"],
MaxTabs = ReadInt("GoogleSheets:MaxTabs", 60),
MaxRowsPerTab = ReadInt("GoogleSheets:MaxRowsPerTab", 5000),
MaxColumns = ReadInt("GoogleSheets:MaxColumns", 200)
});
// One writer, chosen by configuration. "Logging" exercises the whole feature without
// touching Google; anything unrecognised disables the export with a message rather
// than a null reference.
services.AddScoped<ISheetsWriter>(p =>
{
switch (this.Configuration["GoogleSheets:Writer"])
{
case "ServiceAccount":
return new GoogleApiSheetsWriter(
this.Configuration["GoogleSheets:ServiceAccount:CredentialsPath"]);
case "Logging":
return new LoggingSheetsWriter(
p.GetRequiredService<ILogger<LoggingSheetsWriter>>());
default:
return new DisabledSheetsWriter();
}
});
services.AddScoped<ISheetsExportService, SheetsExportService>();
#endregion
}
/// <summary>Configuration is all strings; a missing or unparsable value takes the default.</summary>
private int ReadInt(string key, int fallback)
{
return int.TryParse(this.Configuration[key], out var value) && value > 0 ? value : fallback;
}