Nullify SwarmRegistrationRequest

This commit is contained in:
Jordan Dominion
2023-12-18 15:05:13 -05:00
parent ae505a207c
commit 960f2e4561
2 changed files with 11 additions and 5 deletions
@@ -3,8 +3,6 @@ using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Models.Internal;
#nullable disable
namespace Tgstation.Server.Host.Swarm
{
/// <summary>
@@ -16,6 +14,15 @@ namespace Tgstation.Server.Host.Swarm
/// The TGS <see cref="Version"/> of the sending server.
/// </summary>
[Required]
public Version ServerVersion { get; set; }
public Version ServerVersion { get; }
/// <summary>
/// Initializes a new instance of the <see cref="SwarmRegistrationRequest"/> class.
/// </summary>
/// <param name="serverVersion">The value of <see cref="ServerVersion"/>.</param>
public SwarmRegistrationRequest(Version serverVersion)
{
ServerVersion = serverVersion ?? throw new ArgumentNullException(nameof(serverVersion));
}
}
}
@@ -1267,9 +1267,8 @@ namespace Tgstation.Server.Host.Swarm
null,
HttpMethod.Post,
SwarmConstants.RegisterRoute,
new SwarmRegistrationRequest
new SwarmRegistrationRequest(assemblyInformationProvider.Version)
{
ServerVersion = assemblyInformationProvider.Version,
Identifier = swarmConfiguration.Identifier,
Address = swarmConfiguration.Address,
PublicAddress = swarmConfiguration.PublicAddress,