2024-08-23 18:55:05 +02:00
|
|
|
|
using Microsoft.AspNetCore.Http.HttpResults;
|
|
|
|
|
|
|
2025-06-12 18:22:37 +02:00
|
|
|
|
namespace Vegasco.Server.Api.Info;
|
2024-08-23 18:55:05 +02:00
|
|
|
|
|
|
|
|
|
|
public class GetServerInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
public record Response(
|
|
|
|
|
|
string FullVersion,
|
|
|
|
|
|
string CommitId,
|
2025-06-13 19:39:46 +02:00
|
|
|
|
DateTimeOffset CommitDate,
|
2024-08-23 18:55:05 +02:00
|
|
|
|
string Environment);
|
|
|
|
|
|
|
|
|
|
|
|
public static RouteHandlerBuilder MapEndpoint(IEndpointRouteBuilder builder)
|
|
|
|
|
|
{
|
|
|
|
|
|
return builder
|
|
|
|
|
|
.MapGet("info/server", Endpoint)
|
|
|
|
|
|
.WithTags("Info");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static Ok<Response> Endpoint(
|
|
|
|
|
|
IHostEnvironment environment)
|
|
|
|
|
|
{
|
|
|
|
|
|
return TypedResults.Ok(new Response(
|
|
|
|
|
|
ThisAssembly.AssemblyInformationalVersion,
|
|
|
|
|
|
ThisAssembly.GitCommitId,
|
2025-06-13 19:39:46 +02:00
|
|
|
|
new DateTimeOffset(ThisAssembly.GitCommitDate, TimeSpan.Zero),
|
2024-08-23 18:55:05 +02:00
|
|
|
|
environment.EnvironmentName));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|