Closed fedefernandez closed 1 year ago
The main (03-main) fails because there are no optional configuration defined inside the KafkaConfiguration (producer missing). The both optional fields are set to None. In the test, the configuration seems to load properly. Any hints?
I have tried with this:
given opConsumer: ConfigReader[Option[ConsumerConfiguration]] = ConfigReader.optionReader[ConsumerConfiguration]
but it doesn't load.
There are some other option in the library, but I don't know how to use them:
def fromStringTry[A](fromF: String => Try[A])(implicit ct: ClassTag[A]): ConfigReader[A] = {
fromString[A](tryF(fromF))
}
def fromStringOpt[A](fromF: String => Option[A])(implicit ct: ClassTag[A]): ConfigReader[A] = {
fromString[A](optF(fromF))
}
[X] Compile [X] Test [X] Integration Test [X] Main
Approved and merged.
This library is helpful and can save tons of work. In Scala 3, you need to manually create the readers if you don't want to mix the models with the codecs. If not, you can easily extend your case classes with
ConfigReader
and that's it (see https://pureconfig.github.io/docs/scala-3-derivation.html).I have added a test to check that everything it's working.