fix: response leak, TrackProxyController rename, restore api.json load
This commit is contained in:
@@ -10,13 +10,13 @@ namespace DeepDrftPublic.Controllers;
|
||||
/// named clients — no proxy hop needed on the server side.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TrackController : ControllerBase
|
||||
[Route("api/track")]
|
||||
public class TrackProxyController : ControllerBase
|
||||
{
|
||||
private readonly HttpClient _upstream;
|
||||
private readonly ILogger<TrackController> _logger;
|
||||
private readonly ILogger<TrackProxyController> _logger;
|
||||
|
||||
public TrackController(IHttpClientFactory httpClientFactory, ILogger<TrackController> logger)
|
||||
public TrackProxyController(IHttpClientFactory httpClientFactory, ILogger<TrackProxyController> logger)
|
||||
{
|
||||
_upstream = httpClientFactory.CreateClient("DeepDrft.API");
|
||||
_logger = logger;
|
||||
@@ -103,6 +103,7 @@ public class TrackController : ControllerBase
|
||||
Response.ContentLength = contentLength.Value;
|
||||
|
||||
var stream = await upstream.Content.ReadAsStreamAsync(ct);
|
||||
HttpContext.Response.RegisterForDispose(upstream);
|
||||
return File(stream, contentType, enableRangeProcessing: false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,16 @@ using DeepDrftPublic;
|
||||
using MudBlazor.Services;
|
||||
using DeepDrftPublic.Components;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using NetBlocks.Utilities.Environment;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add MudBlazor services
|
||||
builder.Services.AddMudServices();
|
||||
|
||||
var apiPath = CredentialTools.ResolvePathOrThrow("api", "environment/api.json");
|
||||
builder.Configuration.AddJsonFile(apiPath, optional: false, reloadOnChange: false);
|
||||
|
||||
var contentApiUrl = builder.Configuration["ApiUrls:ContentApi"] ?? throw new Exception("Content API URL is not configured");
|
||||
var sqlApiUrl = builder.Configuration["ApiUrls:SqlApi"] ?? throw new Exception("ApiUrls:SqlApi is not configured");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user