feat: implement JSON backup export functionality with improved download handling
All checks were successful
Publish Container / publish (push) Successful in 3m25s

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Marco 2026-04-24 14:16:15 +02:00
commit bf333c4a00
7 changed files with 96 additions and 5 deletions

View file

@ -1,5 +1,6 @@
using System.Globalization;
using System.Security.Claims;
using NLog;
using NLog.Web;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authentication;
@ -31,12 +32,22 @@ if (!runningInContainer)
builder.WebHost.UseStaticWebAssets();
}
var configuredStorageOptions = builder.Configuration.GetSection(CouchbaseLiteOptions.SectionName).Get<CouchbaseLiteOptions>() ?? new CouchbaseLiteOptions();
var resolvedDatabaseDirectory = ResolveStorageDirectory(configuredStorageOptions.Directory, builder.Environment.ContentRootPath);
var resolvedLogDirectory = Path.Combine(resolvedDatabaseDirectory, "logs");
GlobalDiagnosticsContext.Set("worktrackerLogPath", Path.Combine(resolvedLogDirectory, "worktracker.log"));
GlobalDiagnosticsContext.Set("worktrackerArchiveDirectory", Path.Combine(resolvedLogDirectory, "archive"));
builder.Logging.ClearProviders();
builder.Host.UseNLog();
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.Configure<Microsoft.AspNetCore.Components.Server.CircuitOptions>(options =>
{
options.DetailedErrors = builder.Configuration.GetValue("DetailedErrors", builder.Environment.IsDevelopment());
});
builder.Services.Configure<AppAuthOptions>(builder.Configuration.GetSection(AppAuthOptions.SectionName));
var appAuthOptions = builder.Configuration.GetSection(AppAuthOptions.SectionName).Get<AppAuthOptions>() ?? new AppAuthOptions();
@ -354,3 +365,15 @@ app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();
static string ResolveStorageDirectory(string configuredDirectory, string contentRootPath)
{
if (string.IsNullOrWhiteSpace(configuredDirectory))
{
return Path.Combine(contentRootPath, "App_Data", "couchbase");
}
return Path.IsPathRooted(configuredDirectory)
? configuredDirectory
: Path.GetFullPath(Path.Combine(contentRootPath, configuredDirectory));
}