Files
Hy2026/backend/Infrastructure/Settings/SurrealDbEndpoint.cs
T
Rafał Tyński b3756238a3 feat(backend): restructure API into layers with OpenAPI, versioning and error handling
Split the backend into API host, Domain, Application and Infrastructure projects. Add Swagger/OpenAPI per API version, Asp.Versioning (query/header), ProblemDetails with a global exception handler and SurrealQL migrations applied at startup (namespace/database ensured). Infrastructure owns the SurrealDB client, settings and DI.
2026-10-04 01:49:51 +02:00

22 lines
706 B
C#

namespace TarninaHub.Infrastructure.Settings;
public static class SurrealDbEndpoint
{
/// <summary>
/// Builds the SurrealDB endpoint. Remote mode uses the configured URL;
/// embedded mode uses the RocksDB provider persisted to the data directory
/// (forward slashes, so the same endpoint works on Windows and Linux).
/// </summary>
public static string Build(SurrealDbSettings settings)
{
if (!string.IsNullOrWhiteSpace(settings.RemoteUrl))
{
return settings.RemoteUrl;
}
var dataDirectory = Path.Combine(AppContext.BaseDirectory, settings.DataDirectory);
return $"rocksdb://{dataDirectory.Replace('\\', '/')}";
}
}