Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

how to use ficus to load inner config #10

@kretes

Description

@kretes

I have an example like this:

 "load embedded config with ficus" in {
      import net.ceedubs.ficus.readers.ArbitraryTypeReader._
      import net.ceedubs.ficus.Ficus._
      val config = ConfigFactory.parseString(
        """a { value = 2 }
          |b { value = 3 }""".stripMargin)

      case class Conf(value:Int)

      config.as[Conf]("a").value must_==(2)
      config.as[Conf]("b").value must_==(3)

      def getConf(config:Config) : Conf = {
        config.as[Conf]
      }

      val a:Conf = getConf(config.getConfig("a"))
      val b:Conf = getConf(config.getConfig("b"))
    }

where 'getConf' does not compile. What I want is to make 'getConf' method working as a config parser, which is given config part only, without knowing what the surrounding key was.

currently I nned to do config.asConf or else I do not get a 'Conf' instance.

is it something missing in Ficus, or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions