diff --git a/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala b/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala index 0e09a252..b1bfdee6 100644 --- a/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala +++ b/app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala @@ -29,7 +29,6 @@ trait ApplicationConfig { def thirdPartyDeveloperUrl: String def apiPlatformMicroserviceBaseUrl: String def ramlPreviewMicroserviceBaseUrl: String - def apiDocumentationBaseUrl: String def securedCookie: Boolean def ramlPreviewEnabled: Boolean @@ -58,6 +57,7 @@ trait ApplicationConfig { def cookieSettingsUrl: String def oasFetchResolvedMaxDuration: Long + def oasFetchResolvedUsingHttps: Boolean } @Singleton @@ -80,8 +80,6 @@ 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") @@ -109,6 +107,7 @@ class ApplicationConfigImpl @Inject() (config: Configuration) val cookieSettingsUrl: String = s"/${getString("tracking-consent-frontend.cookie-settings-path")}" val oasFetchResolvedMaxDuration: Long = config.getMillis("oasFetchResolvedMaxDurationMilliseconds") + val oasFetchResolvedUsingHttps: Boolean = getBoolean("oasFetchResolvedUsingHttps") private def platformBaseUrl(key: String) = { (getConfigDefaulted(s"$key.protocol", ""), getConfigDefaulted(s"$key.host", "")) match { diff --git a/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala b/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala index 0fef2931..59b4c455 100644 --- a/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala +++ b/app/uk/gov/hmrc/apidocumentation/controllers/OpenApiDocumentationController.scala @@ -139,17 +139,13 @@ class OpenApiDocumentationController @Inject() ( parseOptions.setResolveFully(true) val emptyAuthList = java.util.Collections.emptyList[io.swagger.v3.parser.core.models.AuthorizationValue]() - - val oasFileLocation = routes.OpenApiDocumentationController.fetchOas(service, version).absoluteURL(true) - - logger.info(s"OAS File Location: $oasFileLocation") + val fetchUsingHttps = appConfig.oasFetchResolvedUsingHttps + val oasFileLocation = routes.OpenApiDocumentationController.fetchOas(service, version).absoluteURL(fetchUsingHttps) val futureParsing = Future { blocking { try { - logger.info("Starting reading OAS specification") val parserResult = openAPIV3Parser.readLocation(oasFileLocation, emptyAuthList, parseOptions) - logger.info("Finished reading OAS specification") Option(parserResult.getOpenAPI()) match { // The OAS specification has been found and parsed by Swagger - return the fully resolved specification to the caller. diff --git a/conf/application.conf b/conf/application.conf index e9f34957..8546b4bb 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -92,6 +92,7 @@ play.filters.csp.directives.script-src = ${play.filters.csp.nonce.pattern} "'str retryCount = 3 retryDelayMilliseconds = 500 oasFetchResolvedMaxDurationMilliseconds = 20000 +oasFetchResolvedUsingHttps = false apidocumentation.base.url = "http://localhost:9680"