diff --git a/src/server/ProxmoxConnector.Server.Application/Queries/System/GetSystemVersion.cs b/src/server/ProxmoxConnector.Server.Application/Queries/System/GetSystemVersion.cs index 68c5f0c..d587a60 100644 --- a/src/server/ProxmoxConnector.Server.Application/Queries/System/GetSystemVersion.cs +++ b/src/server/ProxmoxConnector.Server.Application/Queries/System/GetSystemVersion.cs @@ -1,5 +1,5 @@ using MediatR; -using System.Reflection; +using ProxmoxConnector.Server.Application.Utils; using System.Threading; using System.Threading.Tasks; @@ -27,13 +27,10 @@ namespace ProxmoxConnector.Server.Application.Queries.System public async Task Handle(Query request, CancellationToken cancellationToken) { - var version = GetVersion(); + var version = SystemRegistry.GetVersion(); var result = new Model { Version = version }; return await Task.FromResult(result); } - - private string GetVersion() => - Assembly.GetEntryAssembly().GetCustomAttribute().InformationalVersion; } } } diff --git a/src/server/ProxmoxConnector.Server.Application/Utils/SystemRegistry.cs b/src/server/ProxmoxConnector.Server.Application/Utils/SystemRegistry.cs new file mode 100644 index 0000000..33ef887 --- /dev/null +++ b/src/server/ProxmoxConnector.Server.Application/Utils/SystemRegistry.cs @@ -0,0 +1,10 @@ +using System.Reflection; + +namespace ProxmoxConnector.Server.Application.Utils +{ + public static class SystemRegistry + { + public static string GetVersion() => + Assembly.GetEntryAssembly().GetCustomAttribute().InformationalVersion; + } +} diff --git a/src/server/ProxmoxConnector.Server/Program.cs b/src/server/ProxmoxConnector.Server/Program.cs index 7ffa91d..c0bae3e 100644 --- a/src/server/ProxmoxConnector.Server/Program.cs +++ b/src/server/ProxmoxConnector.Server/Program.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using ProxmoxConnector.Server.Application.Services.Environment; +using ProxmoxConnector.Server.Application.Utils; using Serilog; using Serilog.Core; using Serilog.Events; @@ -9,6 +10,7 @@ using System; using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; namespace ProxmoxConnector.Server { @@ -52,7 +54,7 @@ namespace ProxmoxConnector.Server try { var urls = configuration.GetValue("urls"); - Log.Information("Starting Proxmox connector..."); + Log.Information($"Starting Proxmox connector {SystemRegistry.GetVersion()}..."); Log.Information($"API listening on {urls}"); Log.Information($"Workspace configured at '{workspace}' path"); Console.WriteLine("Application started. Press Ctrl+C to shut down.");