Skip to content

Commit

Permalink
Revert "update to caliban 2.5 and zio-http-rc4 (#110)"
Browse files Browse the repository at this point in the history
This reverts commit b698367.
  • Loading branch information
ghostdogpr committed Mar 6, 2024
1 parent b698367 commit 7390aa1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
15 changes: 7 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ val scala213 = "2.13.11"
val scala3 = "3.3.0"
val allScala = Seq(scala213, scala3)

val zioVersion = "2.0.21"
val zioVersion = "2.0.19"
val zioGrpcVersion = "0.6.0"
val zioK8sVersion = "2.1.1"
val zioK8sVersion = "2.1.0"
val zioCacheVersion = "0.2.3"
val zioCatsInteropVersion = "23.1.0.0"
val sttpVersion = "3.9.3"
val calibanVersion = "2.5.3"
val sttpVersion = "3.9.1"
val calibanVersion = "2.4.3"
val redis4catsVersion = "1.5.2"
val redissonVersion = "3.27.1"
val redissonVersion = "3.23.0"
val scalaKryoVersion = "1.0.2"
val testContainersVersion = "0.41.3"
val testContainersVersion = "0.40.9"

inThisBuild(
List(
Expand Down Expand Up @@ -81,9 +81,8 @@ lazy val manager = project
libraryDependencies ++=
Seq(
"com.github.ghostdogpr" %% "caliban" % calibanVersion,
"com.github.ghostdogpr" %% "caliban-quick" % calibanVersion,
"com.github.ghostdogpr" %% "caliban-zio-http" % calibanVersion,
"com.softwaremill.sttp.tapir" %% "tapir-json-zio" % "1.9.8"
"com.softwaremill.sttp.tapir" %% "tapir-json-zio" % "1.3.0"
)
)

Expand Down
22 changes: 12 additions & 10 deletions manager/src/main/scala/com/devsisters/shardcake/Server.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.devsisters.shardcake

import caliban.interop.tapir.WebSocketInterpreter
import caliban.{ QuickAdapter, ZHttpAdapter }
import caliban.ZHttpAdapter
import caliban.wrappers.Wrappers.printErrors
import sttp.tapir.json.zio._
import zio.http.{ Server => ZServer, _ }
import zio._
import caliban.interop.tapir.HttpInterpreter
import caliban.interop.tapir.WebSocketInterpreter

object Server {

Expand All @@ -16,21 +17,22 @@ object Server {
for {
config <- ZIO.service[ManagerConfig]
interpreter <- (GraphQLApi.api @@ printErrors).interpreter
apiHandler = QuickAdapter(interpreter).handlers.api
routes = Routes(
Method.ANY / "health" -> Handler.ok,
Method.ANY / "api" / "graphql" -> apiHandler,
Method.ANY / "ws" / "graphql" ->
ZHttpAdapter.makeWebSocketService(WebSocketInterpreter(interpreter))
) @@ Middleware.cors
routes = Http
.collectHttp[Request] {
case _ -> Root / "health" => Handler.ok.toHttp
case _ -> Root / "api" / "graphql" => ZHttpAdapter.makeHttpService(HttpInterpreter(interpreter))
case _ -> Root / "ws" / "graphql" =>
ZHttpAdapter.makeWebSocketService(WebSocketInterpreter(interpreter))
} @@ HttpAppMiddleware.cors()
_ <- ZIO.logInfo(s"Shard Manager server started on port ${config.apiPort}.")
nothing <- ZServer
.serve(routes.toHttpApp)
.serve(routes)
.provideSome[ShardManager](
ZServer.live,
ZLayer.succeed(
ZServer.Config.default
.port(config.apiPort)
.withWebSocketConfig(ZHttpAdapter.defaultWebSocketConfig)
)
)
} yield nothing
Expand Down

0 comments on commit 7390aa1

Please sign in to comment.