Adapts a Typesafe Config to a Knobs Config.
Adapts a Typesafe Config to a Knobs Config.
Caution: Typesafe Config's grammar does not distinguish a duration type from other String values. This means that durations are not extracted in knobs in the same way as using the native Typesafe Config API:
scala> val ts = ConfigFactory.parseString(""" "dur" = 3 seconds """) ts: com.typesafe.config.Config = Config(SimpleConfigObject({"dur":"3 seconds"})) scala> ts.getDuration("dur", java.util.concurrent.TimeUnit.MILLISECONDS) res0: Long = 3000 scala> val k = knobs.Typesafe.config[IO](ts).unsafePerformSync k: knobs.Config = Config(Map(dur -> CfgText(3 seconds))) scala> k.lookup[Duration]("dur") res1: Option[scala.concurrent.duration.Duration] = None scala> k.lookup[String]("dur") res2: Option[String] = Some(3 seconds)
(Since version 4.0.31) Does not support interpolation of environment variables
(Since version 4.0.31) Does not support interpolation of environment variables