From 88420420d27fb54c6ee8ac7814812253efbd39cc Mon Sep 17 00:00:00 2001 From: Bing Zhang Date: Fri, 1 Dec 2023 11:44:00 -0600 Subject: [PATCH] keep both ways to show swagger api doc --- app/controllers/Application.scala | 6 +++--- conf/application.conf | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/Application.scala b/app/controllers/Application.scala index 292e4d01d..2c6ef015d 100644 --- a/app/controllers/Application.scala +++ b/app/controllers/Application.scala @@ -32,10 +32,10 @@ class Application @Inject()(files: FileService, collections: CollectionService, def swaggerUI = Action { implicit request => val swagger = routes.Application.swagger().absoluteURL(Utils.https(request)) val swaggerUIHost = play.Play.application().configuration().getString("swaggerUIHost") - if (swaggerUIHost != null) { - Redirect(swaggerUIHost) + if (swaggerUIHost == null) { + Redirect("http://clowder.ncsa.illinois.edu/swagger/?url=" + swagger) } else { - NotFound("Could not find swagger ui host") + Redirect(swaggerUIHost) } } diff --git a/conf/application.conf b/conf/application.conf index 2aad1f5df..98262fa05 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -123,6 +123,11 @@ clowder.license { download=false } +# swagger api doc host +# if no setting of swaggerUIHost, it will use https://clowder.ncsa.illinois.edu/swagger to show the swagger api doc. +# otherwise, you can point `swaggerUIHost` to your swagger-ui url to show the swagger api doc. +swaggerUIHost="http://localhost:8082" + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Space related information # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~