Skip to content

Commit

Permalink
Upgrade ZIO to 1.0.0-RC20 (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdogpr authored May 27, 2020
1 parent 4b3b2df commit 527430c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import zio.interop.catz._
import zio.telemetry.opentelemetry.Tracing
import zio.telemetry.opentelemetry.example.config.{ Config, Configuration }
import zio.telemetry.opentelemetry.example.http.{ AppEnv, AppTask, Client, StatusService }
import zio.{ Managed, ZIO, ZLayer }
import zio.{ ExitCode, Managed, ZIO, ZLayer }
import org.http4s.syntax.kleisli._
import sttp.client.asynchttpclient.zio.AsyncHttpClientZioBackend

Expand All @@ -34,5 +34,6 @@ object BackendServer extends zio.App {
val tracer = Configuration.live >>> JaegerTracer.live("zio-backend")
val envLayer = tracer ++ Clock.live >>> Tracing.live ++ Configuration.live ++ client

override def run(args: List[String]) = server.provideCustomLayer(envLayer).fold(_ => 1, _ => 0)
override def run(args: List[String]) =
server.provideCustomLayer(envLayer).fold(_ => ExitCode.failure, _ => ExitCode.success)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import zio.interop.catz._
import zio.telemetry.opentelemetry.Tracing
import zio.telemetry.opentelemetry.example.config.{ Config, Configuration }
import zio.telemetry.opentelemetry.example.http.{ AppEnv, AppTask, Client, StatusesService }
import zio.{ Managed, ZIO, ZLayer }
import zio.{ ExitCode, Managed, ZIO, ZLayer }
import org.http4s.syntax.kleisli._
import sttp.client.asynchttpclient.zio.AsyncHttpClientZioBackend

Expand Down Expand Up @@ -35,5 +35,6 @@ object ProxyServer extends zio.App {
val tracer = Configuration.live >>> JaegerTracer.live("zio-proxy")
val envLayer = tracer ++ Clock.live >>> Tracing.live ++ Configuration.live ++ client

override def run(args: List[String]) = server.provideCustomLayer(envLayer).fold(_ => 1, _ => 0)
override def run(args: List[String]) =
server.provideCustomLayer(envLayer).fold(_ => ExitCode.failure, _ => ExitCode.success)
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package zio.telemetry.opentracing.example

import cats.effect.ExitCode
import cats.effect.{ ExitCode => catsExitCode }
import org.http4s.server.Router
import org.http4s.server.blaze.BlazeServerBuilder
import org.http4s.syntax.kleisli._
import zio.interop.catz._
import zio.telemetry.opentracing.example.JaegerTracer.makeService
import zio.telemetry.opentracing.example.config.Configuration
import zio.telemetry.opentracing.example.http.{ AppTask, StatusService }
import zio.{ ZEnv, ZIO }
import zio.{ ExitCode, ZEnv, ZIO }

object BackendServer extends CatsApp {

override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] =
override def run(args: List[String]): ZIO[ZEnv, Nothing, ExitCode] =
(for {
conf <- Configuration.load.provideLayer(Configuration.live)
service = makeService(conf.tracer.host, "zio-backend")
Expand All @@ -21,8 +21,8 @@ object BackendServer extends CatsApp {
.bindHttp(conf.backend.port, conf.backend.host)
.withHttpApp(router)
.serve
.compile[AppTask, AppTask, ExitCode]
.compile[AppTask, AppTask, catsExitCode]
.drain
.as(0)
} yield result).orElse(ZIO.succeed(1))
.as(ExitCode.success)
} yield result).orElse(ZIO.succeed(ExitCode.failure))
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package zio.telemetry.opentracing.example

import cats.effect.ExitCode
import cats.effect.{ ExitCode => catsExitCode }
import org.http4s.server.Router
import org.http4s.server.blaze.BlazeServerBuilder
import org.http4s.syntax.kleisli._
Expand All @@ -9,11 +9,11 @@ import zio.interop.catz._
import zio.telemetry.opentracing.example.JaegerTracer.makeService
import zio.telemetry.opentracing.example.config.Configuration
import zio.telemetry.opentracing.example.http.{ AppTask, StatusesService }
import zio.{ ZEnv, ZIO }
import zio.{ ExitCode, ZEnv, ZIO }

object ProxyServer extends CatsApp {

override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] =
override def run(args: List[String]): ZIO[ZEnv, Nothing, ExitCode] =
(for {
conf <- Configuration.load.provideLayer(Configuration.live)
service = makeService(conf.tracer.host, "zio-proxy")
Expand All @@ -23,9 +23,9 @@ object ProxyServer extends CatsApp {
.bindHttp(conf.proxy.port, conf.proxy.host)
.withHttpApp(router)
.serve
.compile[AppTask, AppTask, ExitCode]
.compile[AppTask, AppTask, catsExitCode]
.drain
.as(0)
} yield result) orElse ZIO.succeed(1)
.as(ExitCode.success)
} yield result) orElse ZIO.succeed(ExitCode.failure)

}
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object Dependencies {
val opentelemetry = "0.3.0"
val opencensus = "0.26.0"
val zipkin = "2.15.0"
val zio = "1.0.0-RC19-2"
val zio = "1.0.0-RC20"
}

lazy val zio = Seq(
Expand Down

0 comments on commit 527430c

Please sign in to comment.