diff --git a/conf-example.json b/conf-example.json index 1504fe0d..db7297c1 100644 --- a/conf-example.json +++ b/conf-example.json @@ -5,6 +5,7 @@ "uploadsDirectory": "uploads/", "workingDirectory": "./", "rolePermissionsPath": "./role-permissions.json", + "openApiUrl": "https://my.domain.com/api/docs", "database" : { "host" : "localhost", diff --git a/src/main/scala/com/campudus/tableaux/Starter.scala b/src/main/scala/com/campudus/tableaux/Starter.scala index 1fce925c..7f82b532 100644 --- a/src/main/scala/com/campudus/tableaux/Starter.scala +++ b/src/main/scala/com/campudus/tableaux/Starter.scala @@ -53,6 +53,7 @@ class Starter extends ScalaVerticle with LazyLogging { val uploadsDirectory = getStringDefault(config, "uploadsDirectory", Starter.DEFAULT_UPLOADS_DIRECTORY) val authConfig = config.getJsonObject("auth", Json.obj()) val rolePermissionsPath = getStringDefault(config, "rolePermissionsPath", Starter.DEFAULT_ROLE_PERMISSIONS_PATH) + val openApiUrl = getStringDefault(config, "openApiUrl", "") val rolePermissions = FileUtils(vertxAccessContainer()).readJsonFile(rolePermissionsPath, Json.emptyObj()) @@ -62,7 +63,8 @@ class Starter extends ScalaVerticle with LazyLogging { authConfig = authConfig, workingDirectory = workingDirectory, uploadsDirectory = uploadsDirectory, - rolePermissions = rolePermissions + rolePermissions = rolePermissions, + openApiUrl = openApiUrl ) connection = SQLConnection(vertxAccessContainer(), databaseConfig) diff --git a/src/main/scala/com/campudus/tableaux/TableauxConfig.scala b/src/main/scala/com/campudus/tableaux/TableauxConfig.scala index d9b76f3b..7bb8644a 100644 --- a/src/main/scala/com/campudus/tableaux/TableauxConfig.scala +++ b/src/main/scala/com/campudus/tableaux/TableauxConfig.scala @@ -13,6 +13,7 @@ class TableauxConfig( databaseConfig: JsonObject, workingDirectory: String, uploadsDirectory: String, + val openApiUrl: String, val rolePermissions: JsonObject ) extends VertxAccess { diff --git a/src/main/scala/com/campudus/tableaux/router/DocumentationRouter.scala b/src/main/scala/com/campudus/tableaux/router/DocumentationRouter.scala index 841e6c68..a3d1dea6 100644 --- a/src/main/scala/com/campudus/tableaux/router/DocumentationRouter.scala +++ b/src/main/scala/com/campudus/tableaux/router/DocumentationRouter.scala @@ -133,7 +133,7 @@ class DocumentationRouter(override val config: TableauxConfig) extends BaseRoute val uri = (forwardedScheme, forwardedHost, forwardedUrl) match { case (Some(scheme), Some(host), Some(query)) => s"$scheme://$host$query" - case _ => request.absoluteURI() + case _ => config.openApiUrl } DocUriParser.parse(uri)