using Serilog; using System.Net.Http; using WorkFlowCheck.Common.DTO; namespace WorkFlowCheck.Web.Helpers { public static class SystemHelper { public static string DatabaseName = ""; public static string ProgramVersion = "v1.1.030"; public async static Task GetAPIInfoAsync(IConfiguration configuration) { using (var httpClient = new HttpClient()) { var apiBaseUrl = configuration["ApiBaseUrl"]; // API-cím elérése a konfigurációból httpClient.BaseAddress = new Uri(apiBaseUrl); var apiKey = configuration["ApiKey"]; httpClient.DefaultRequestHeaders.Add("X-Api-Key", apiKey); string endpoint = $"{httpClient.BaseAddress}api/System/GetDatabaseAndVersionInfo"; var retVal = new RoleDTO(); try { var response = await httpClient.GetFromJsonAsync>(endpoint); if (response != null) { if (response.IsSuccess) { DatabaseName = response.Data; } } } catch (Exception ex) { Log.Error(ex.Message); } } } } }