Last active
December 10, 2017 07:58
-
-
Save geoHeil/a71c87bac767cba859faf817fca5315e to your computer and use it in GitHub Desktop.
configuration ficus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.typesafe.config.{ Config, ConfigFactory } | |
import net.ceedubs.ficus.Ficus._ | |
import net.ceedubs.ficus.readers.ValueReader | |
import net.ceedubs.ficus.readers.namemappers.implicits.hyphenCase | |
object ConfigurationUtils { | |
def loadConfiguration[T: ValueReader](): T = { | |
val config: Config = ConfigFactory.load() | |
config.as[T] | |
} | |
} | |
// ....................................................... | |
case class EasyToDecode(a: String, b: String, c: String) | |
// ......................................................... | |
import net.ceedubs.ficus.readers.ArbitraryTypeReader._ | |
object Foo extends App{ | |
val c = ConfigurationUtils.loadConfiguration[EasyToDecode] | |
} |
I use `scalaVersion := "2.11.12"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This compiles just fine for me with Ficus 1.4.3 on 2.12.2.