Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update zio-config to 4.0.1 #932

Merged
merged 7 commits into from
Feb 15, 2024

Conversation

drmarjanovic
Copy link
Collaborator

@drmarjanovic drmarjanovic commented Feb 8, 2024

Resolves #929

@drmarjanovic drmarjanovic self-assigned this Feb 8, 2024
@drmarjanovic drmarjanovic requested a review from a team as a code owner February 8, 2024 20:43
Comment on lines 31 to 37
private[this] final val Config = ConfigFactory.load.getConfig("example")
private[this] final val Descriptor = deriveConfig[AppConfig]

lazy val layer: ZLayer[Any, ReadError[String], Env] =
TypesafeConfig.fromTypesafeConfig(Config, Descriptor) >+>
ZLayer.service[AppConfig].narrow(_.redis)
lazy val layer: Layer[ConfigError, Env] = {
val config = TypesafeConfigProvider.fromTypesafeConfig(Config).load(Descriptor)
ZLayer.fromZIO(config) ++ ZLayer.fromZIO(config.map(_.redis))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's follow the standard example

private[this] final val Config = ZIO.attempt(ConfigFactory.load.getConfig("example"))
private[this] final val Descriptor = descriptor[AppConfig]
final val provider: ConfigProvider =
TypesafeConfigProvider.fromTypesafeConfig(ConfigFactory.load.getConfig("example"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to bootstrap.

Comment on lines 33 to 34
final val layer: Layer[Config.Error, RedisConfig] =
ZLayer.fromZIO(ZIO.config(config).map(_.redis))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it makes sense to provide both.

@mijicd mijicd merged commit bfb12fc into zio:master Feb 15, 2024
12 checks passed
@drmarjanovic drmarjanovic deleted the update/zio-config-magnolia-4.0.1 branch February 15, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants