Skip to content

Commit

Permalink
Use 'project' for ZIO Config (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
drmarjanovic authored Apr 23, 2024
1 parent adc64ae commit bfb5576
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/example/src/main/scala/example/config/AppConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import zio.{Config, Layer, ZIO, ZLayer}
final case class AppConfig(http: HttpConfig, elasticsearch: ElasticsearchConfig)

object AppConfig {
private[this] final val config = ZIO.config(deriveConfig[AppConfig])
private[this] final val config = ZLayer(ZIO.config(deriveConfig[AppConfig]))

lazy val live: Layer[Config.Error, ElasticsearchConfig with HttpConfig] =
ZLayer(config.map(_.elasticsearch)) ++ ZLayer(config.map(_.http))
config.project(_.elasticsearch) ++ config.project(_.http)
}

0 comments on commit bfb5576

Please sign in to comment.