From e330ce3998bc0fdb17b277abaa9aef27b5516361 Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Tue, 27 Feb 2024 11:15:07 +0100 Subject: [PATCH] fix: do not prefix swagger document in development (#491) --- src/Digdir.Domain.Dialogporten.WebApi/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Digdir.Domain.Dialogporten.WebApi/Program.cs b/src/Digdir.Domain.Dialogporten.WebApi/Program.cs index 076e2b50b..879ecd58f 100644 --- a/src/Digdir.Domain.Dialogporten.WebApi/Program.cs +++ b/src/Digdir.Domain.Dialogporten.WebApi/Program.cs @@ -182,9 +182,9 @@ static void BuildAndRun(string[] args) { // Hide schemas view uiConfig.DefaultModelsExpandDepth = -1; - // We have to add dialogporten here to get the correct base url for swagger.json in the APIM - // todo: we cannot have dialogporten as prefix when we run this locally. Won't be available on container apps either. - uiConfig.DocumentPath = "/dialogporten/swagger/{documentName}/swagger.json"; + // We have to add dialogporten here to get the correct base url for swagger.json in the APIM. Should not be done for development + var dialogPrefix = builder.Environment.IsDevelopment() ? "" : "/dialogporten"; + uiConfig.DocumentPath = dialogPrefix + "/swagger/{documentName}/swagger.json"; }); app.MapControllers(); app.MapHealthChecks("/healthz");