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

29 lines
761 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 class GetServerInfo
{
public record Response(
string FullVersion,
string CommitId,
DateTime CommitDate,
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,
ThisAssembly.GitCommitDate,
environment.EnvironmentName));
}
}