diff --git a/util/Setup/Program.cs b/util/Setup/Program.cs index 3530352252..776f672348 100644 --- a/util/Setup/Program.cs +++ b/util/Setup/Program.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Data.SqlClient; using System.Globalization; using System.Net.Http; -using System.Text.Json; +using System.Net.Http.Json; using Bit.Migrator; namespace Bit.Setup @@ -272,10 +272,8 @@ namespace Bit.Setup return false; } - var resultString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); - using var jsonDocument = JsonSerializer.Deserialize(resultString); - var root = jsonDocument.RootElement; - if (!root.GetProperty("Enabled").GetBoolean()) + var result = response.Content.ReadFromJsonAsync().GetAwaiter().GetResult(); + if (!result.Enabled) { Console.WriteLine("Installation id has been disabled."); return false; @@ -326,5 +324,10 @@ namespace Bit.Setup _context.Parameters.Add(_context.Args[i].Substring(1), _context.Args[i + 1]); } } + + class InstallationValidationResponseModel + { + public bool Enabled { get; init; } + } } }