mirror of
https://github.com/arcan1s/ffxivbis.git
synced 2025-04-25 01:37:17 +00:00
fix api urls in swagger
This commit is contained in:
parent
65a4a25b3a
commit
666a1b8b7a
@ -54,6 +54,8 @@ me.arcanis.ffxivbis {
|
|||||||
host = "127.0.0.1"
|
host = "127.0.0.1"
|
||||||
# port to bind, int, required
|
# port to bind, int, required
|
||||||
port = 8000
|
port = 8000
|
||||||
|
# hostname to use in docs, if not set host:port will be used
|
||||||
|
#hostname = "127.0.0.1:8000"
|
||||||
|
|
||||||
# rate limits
|
# rate limits
|
||||||
limits {
|
limits {
|
||||||
|
@ -29,6 +29,7 @@ class RootEndpoint(system: ActorSystem, storage: ActorRef, ariyala: ActorRef)
|
|||||||
|
|
||||||
private val rootApiV1Endpoint: RootApiV1Endpoint = new RootApiV1Endpoint(storage, ariyala, config)
|
private val rootApiV1Endpoint: RootApiV1Endpoint = new RootApiV1Endpoint(storage, ariyala, config)
|
||||||
private val rootView: RootView = new RootView(storage, ariyala)
|
private val rootView: RootView = new RootView(storage, ariyala)
|
||||||
|
private val swagger: Swagger = new Swagger(config)
|
||||||
private val httpLogger = Logger("http")
|
private val httpLogger = Logger("http")
|
||||||
|
|
||||||
private val withHttpLog: Directive0 =
|
private val withHttpLog: Directive0 =
|
||||||
@ -43,7 +44,7 @@ class RootEndpoint(system: ActorSystem, storage: ActorRef, ariyala: ActorRef)
|
|||||||
|
|
||||||
def route: Route =
|
def route: Route =
|
||||||
withHttpLog {
|
withHttpLog {
|
||||||
apiRoute ~ htmlRoute ~ Swagger.routes ~ swaggerUIRoute
|
apiRoute ~ htmlRoute ~ swagger.routes ~ swaggerUIRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
private def apiRoute: Route =
|
private def apiRoute: Route =
|
||||||
|
@ -10,11 +10,12 @@ package me.arcanis.ffxivbis.http
|
|||||||
|
|
||||||
import com.github.swagger.akka.SwaggerHttpService
|
import com.github.swagger.akka.SwaggerHttpService
|
||||||
import com.github.swagger.akka.model.{Info, License}
|
import com.github.swagger.akka.model.{Info, License}
|
||||||
|
import com.typesafe.config.Config
|
||||||
import io.swagger.v3.oas.models.security.SecurityScheme
|
import io.swagger.v3.oas.models.security.SecurityScheme
|
||||||
|
|
||||||
import scala.io.Source
|
import scala.io.Source
|
||||||
|
|
||||||
object Swagger extends SwaggerHttpService {
|
class Swagger(config: Config) extends SwaggerHttpService {
|
||||||
override val apiClasses: Set[Class[_]] = Set(
|
override val apiClasses: Set[Class[_]] = Set(
|
||||||
classOf[api.v1.BiSEndpoint], classOf[api.v1.LootEndpoint],
|
classOf[api.v1.BiSEndpoint], classOf[api.v1.LootEndpoint],
|
||||||
classOf[api.v1.PlayerEndpoint], classOf[api.v1.TypesEndpoint],
|
classOf[api.v1.PlayerEndpoint], classOf[api.v1.TypesEndpoint],
|
||||||
@ -28,12 +29,16 @@ object Swagger extends SwaggerHttpService {
|
|||||||
license = Some(License("BSD", "https://raw.githubusercontent.com/arcan1s/ffxivbis/master/LICENSE"))
|
license = Some(License("BSD", "https://raw.githubusercontent.com/arcan1s/ffxivbis/master/LICENSE"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override val host: String =
|
||||||
|
if (config.hasPath("me.arcanis.ffxivbis.web.hostname")) config.getString("me.arcanis.ffxivbis.web.hostname")
|
||||||
|
else s"${config.getString("me.arcanis.ffxivbis.web.host")}:${config.getString("me.arcanis.ffxivbis.web.port")}"
|
||||||
|
|
||||||
private val basicAuth = new SecurityScheme()
|
private val basicAuth = new SecurityScheme()
|
||||||
.description("basic http auth")
|
.description("basic http auth")
|
||||||
.`type`(SecurityScheme.Type.HTTP)
|
.`type`(SecurityScheme.Type.HTTP)
|
||||||
.in(SecurityScheme.In.HEADER)
|
.in(SecurityScheme.In.HEADER)
|
||||||
.scheme("bearer")
|
.scheme("bearer")
|
||||||
override def securitySchemes: Map[String, SecurityScheme] = Map("basic auth" -> basicAuth)
|
override val securitySchemes: Map[String, SecurityScheme] = Map("basic auth" -> basicAuth)
|
||||||
|
|
||||||
override val unwantedDefinitions: Seq[String] =
|
override val unwantedDefinitions: Seq[String] =
|
||||||
Seq("Function1", "Function1RequestContextFutureRouteResult")
|
Seq("Function1", "Function1RequestContextFutureRouteResult")
|
||||||
|
@ -1 +1 @@
|
|||||||
version := "0.9.5"
|
version := "0.9.6"
|
||||||
|
Loading…
Reference in New Issue
Block a user