From 071106238a4283ed70336af74f773d3a1a6ad196 Mon Sep 17 00:00:00 2001 From: Pete Slater Date: Fri, 26 May 2023 03:57:00 -0500 Subject: [PATCH] API-7065 - Using base url for docs fe when fetching oas file (#457) --- .../gov/hmrc/apidocumentation/config/ApplicationConfig.scala | 3 +++ .../controllers/OpenApiDocumentationController.scala | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala b/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala index 8e5dbb61..0e09a252 100644 --- a/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala +++ b/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala @@ -29,6 +29,7 @@ trait ApplicationConfig { def thirdPartyDeveloperUrl: String def apiPlatformMicroserviceBaseUrl: String def ramlPreviewMicroserviceBaseUrl: String + def apiDocumentationBaseUrl: String def securedCookie: Boolean def ramlPreviewEnabled: Boolean @@ -79,6 +80,8 @@ class ApplicationConfigImpl @Inject() (config: Configuration) lazy val apiPlatformMicroserviceBaseUrl = baseUrl("api-platform-microservice") lazy val ramlPreviewMicroserviceBaseUrl = baseUrl("raml-preview-microservice") + lazy val apiDocumentationBaseUrl = getString("apidocumentation.base.url") + val securedCookie = getBoolean("cookie.secure") val ramlPreviewEnabled = getBoolean("features.ramlPreview") val openApiPreviewEnabled = getBoolean("features.openApiPreview") diff --git a/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala b/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala index ad3aef33..65880043 100644 --- a/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala +++ b/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala @@ -138,7 +138,7 @@ class OpenApiDocumentationController @Inject() ( val emptyAuthList = java.util.Collections.emptyList[io.swagger.v3.parser.core.models.AuthorizationValue]() - val oasFileLocation = routes.OpenApiDocumentationController.fetchOas(service, version).absoluteURL() + val oasFileLocation = s"${appConfig.apiDocumentationBaseUrl}${routes.OpenApiDocumentationController.fetchOas(service, version).url}" val futureParsing = Future { blocking {