-
Notifications
You must be signed in to change notification settings - Fork 64
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
Update zio-config to 4.0.1 #932
Conversation
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)) | ||
} |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to bootstrap.
final val layer: Layer[Config.Error, RedisConfig] = | ||
ZLayer.fromZIO(ZIO.config(config).map(_.redis)) |
There was a problem hiding this comment.
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.
Resolves #929