From b151605c28d3d0e6e24c843b903b97e1de42518a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Tom=C3=A9?= <108268980+r-tome@users.noreply.github.com> Date: Mon, 3 Jul 2023 21:43:13 +0100 Subject: [PATCH] [PM-2594] Added new property "CloudRegion" to GlobalSettings and ConfigResponseModel to be able to override the cloud url value for selfhost instances (#3024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [PM-2594] Added new property "CloudVault" to GlobalSettings and ConfigResponseModel to be able to override this value for selfhost instances * [PM-2594] Renamed EnvironmentConfigResponseModel.CloudVault to CloudWebVault * [PM-2594] Added default value for globalSettings__baseServiceUri__cloudWebVault on EnvironmentFileBuilder * [PM-2594] Erased CloudWebVault environment variable and added CloudVaultRegion * [PM-2594] Changed var name on EnvironmentFileBuilder * [PM-2594] Renamed the env. variable and also the output property to CloudRegion --- src/Api/Models/Response/ConfigResponseModel.cs | 2 ++ src/Core/Settings/GlobalSettings.cs | 1 + src/Core/Settings/IBaseServiceUriSettings.cs | 1 + util/Setup/EnvironmentFileBuilder.cs | 1 + 4 files changed, 5 insertions(+) diff --git a/src/Api/Models/Response/ConfigResponseModel.cs b/src/Api/Models/Response/ConfigResponseModel.cs index 2e85a3a30d..e560271c00 100644 --- a/src/Api/Models/Response/ConfigResponseModel.cs +++ b/src/Api/Models/Response/ConfigResponseModel.cs @@ -28,6 +28,7 @@ public class ConfigResponseModel : ResponseModel GitHash = AssemblyHelpers.GetGitHash(); Environment = new EnvironmentConfigResponseModel { + CloudRegion = globalSettings.BaseServiceUri.CloudRegion, Vault = globalSettings.BaseServiceUri.Vault, Api = globalSettings.BaseServiceUri.Api, Identity = globalSettings.BaseServiceUri.Identity, @@ -46,6 +47,7 @@ public class ServerConfigResponseModel public class EnvironmentConfigResponseModel { + public string CloudRegion { get; set; } public string Vault { get; set; } public string Api { get; set; } public string Identity { get; set; } diff --git a/src/Core/Settings/GlobalSettings.cs b/src/Core/Settings/GlobalSettings.cs index 3c3d3e0c55..008bf46eff 100644 --- a/src/Core/Settings/GlobalSettings.cs +++ b/src/Core/Settings/GlobalSettings.cs @@ -143,6 +143,7 @@ public class GlobalSettings : IGlobalSettings _globalSettings = globalSettings; } + public string CloudRegion { get; set; } public string Vault { get; set; } public string VaultWithHash => $"{Vault}/#"; diff --git a/src/Core/Settings/IBaseServiceUriSettings.cs b/src/Core/Settings/IBaseServiceUriSettings.cs index 0550ae3e67..0acb504a2b 100644 --- a/src/Core/Settings/IBaseServiceUriSettings.cs +++ b/src/Core/Settings/IBaseServiceUriSettings.cs @@ -3,6 +3,7 @@ namespace Bit.Core.Settings; public interface IBaseServiceUriSettings { + string CloudRegion { get; set; } string Vault { get; set; } string VaultWithHash { get; } string Api { get; set; } diff --git a/util/Setup/EnvironmentFileBuilder.cs b/util/Setup/EnvironmentFileBuilder.cs index bba4180858..5babc6ca88 100644 --- a/util/Setup/EnvironmentFileBuilder.cs +++ b/util/Setup/EnvironmentFileBuilder.cs @@ -73,6 +73,7 @@ public class EnvironmentFileBuilder _globalOverrideValues = new Dictionary { ["globalSettings__baseServiceUri__vault"] = _context.Config.Url, + ["globalSettings__baseServiceUri__cloudVaultRegion"] = "US", ["globalSettings__sqlServer__connectionString"] = $"\"{dbConnectionString.Replace("\"", "\\\"")}\"", ["globalSettings__identityServer__certificatePassword"] = _context.Install?.IdentityCertPassword, ["globalSettings__internalIdentityKey"] = _context.Stub ? "RANDOM_IDENTITY_KEY" :