Skip to content

Instantly share code, notes, and snippets.

@codeomnitrix
Created September 27, 2018 06:48
Show Gist options
  • Save codeomnitrix/cd221882d4a9d464b0413b2cfb7d5f07 to your computer and use it in GitHub Desktop.
Save codeomnitrix/cd221882d4a9d464b0413b2cfb7d5f07 to your computer and use it in GitHub Desktop.
import pureconfig._
import com.typesafe.config.ConfigFactory
case class Person(id: Int, name: String, number: String)
object PureConfigTest extends App {
val person = loadConfig[Person](ConfigFactory.load("conf123/application.conf")) match {
case Right(conf) => conf
case Left(failures) =>
throw new Exception(s"Unable to load the configuration ${failures.toList.mkString("\n")}")
}
println(person.name)
println(person.number)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment