diff --git a/src/HeartTrackAPI/Utils/AppBootstrap.cs b/src/HeartTrackAPI/Utils/AppBootstrap.cs index 1041212..422024e 100644 --- a/src/HeartTrackAPI/Utils/AppBootstrap.cs +++ b/src/HeartTrackAPI/Utils/AppBootstrap.cs @@ -188,9 +188,22 @@ public class AppBootstrap(IConfiguration configuration) { options.PreSerializeFilters.Add((swagger, httpReq) => { + if (httpReq.Headers.ContainsKey("X-Forwarded-Host")) { - var basePath = "containers/HeartDev-api"; + string basePath; + switch (Environment.GetEnvironmentVariable("TYPE")) // httpReq.Host.Value + { + case "STUB" : + basePath = "containers/HeartDev-heart_stub"; + break; + case "BDD": + basePath = "containers/HeartDev-api"; + break; + default: + basePath = httpReq.Host.Value; + break; + } var serverUrl = $"https://{httpReq.Headers["X-Forwarded-Host"]}/{basePath}"; swagger.Servers = new List { new() { Url = serverUrl } }; }