From 5b583f45d654a2a2f4ed923832ed31c838aefb4b Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Fri, 6 Sep 2024 18:40:40 +0200 Subject: [PATCH] Update base URL retrieval to use configuration setting Replaced hardcoded base URL construction with a configuration-based approach for better management and flexibility. Updated `appsettings.json` to include the new `BaseUrl` setting under the `Hosting` section. --- src/apps/Elsa.ServerAndStudio.Web/Pages/_Host.cshtml | 2 +- src/apps/Elsa.ServerAndStudio.Web/appsettings.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/Elsa.ServerAndStudio.Web/Pages/_Host.cshtml b/src/apps/Elsa.ServerAndStudio.Web/Pages/_Host.cshtml index 1c146068a..c2217d30d 100644 --- a/src/apps/Elsa.ServerAndStudio.Web/Pages/_Host.cshtml +++ b/src/apps/Elsa.ServerAndStudio.Web/Pages/_Host.cshtml @@ -2,7 +2,7 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @inject IConfiguration Configuration; @{ - var baseUrl = $"{Request.Scheme}://{Request.Host}"; + var baseUrl = Configuration["Hosting:BaseUrl"]!; var apiUrl = baseUrl + Url.Content("~/elsa/api"); var basePath = Configuration["Hosting:BasePath"]!; } diff --git a/src/apps/Elsa.ServerAndStudio.Web/appsettings.json b/src/apps/Elsa.ServerAndStudio.Web/appsettings.json index d9f27f46c..13e1398d5 100644 --- a/src/apps/Elsa.ServerAndStudio.Web/appsettings.json +++ b/src/apps/Elsa.ServerAndStudio.Web/appsettings.json @@ -18,6 +18,7 @@ "MySql": "Server=localhost;Database=elsa;Uid=user;Pwd=password;" }, "Hosting": { + "BaseUrl": "https://localhost:5001", "BasePath": "" }, "Identity": {