Files
vegasco/src/Vegasco.Server.Api/Info/GetServerInfo.cs

29 lines
692 B
C#
Raw Normal View History

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