fallatol.config.package.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fallatol-config_sjs1_3 Show documentation
Show all versions of fallatol-config_sjs1_3 Show documentation
A collection of Type classes and utilities for use with the `sconfig` library
The newest version!
package fallatol
import org.ekrich.config.Config
/** Provides type classes for extracting values in a generic manner from HOCON
* config files read by the library
* [[https://github.com/ekrich/sconfig sconfig]].
*
* @example {{{
*
* import fallatol.config._
* import org.ekrich.config._
*
* val config = ConfigFactory.parseString(
* """
* |foo = "bar"
* |meaning_of_life = 42
* |""".stripMargin)
*
* val foo: ConfigResult[String] = config.get[String]("foo")
* val meaningOfLife: ConfigResult[Int] = config.get[Int]("bar")
* }}}
*/
package object config {
/** Type alias for */
type ConfigResult[T] = Either[Throwable, T]
implicit class ConfigOps(config: Config) {
final def get[A](path: String)(implicit
cf: ConfigGetter[A]
): ConfigResult[A] =
cf.get(config, path)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy