Skip to content

How to include a file? #87

@colindean

Description

@colindean

I'm using ruby-hocon to construct a HOCON file.

Setting values is pretty straightforward, e.g. myconf.set_value("whatever.somewhere", "some_value"), but I'm having trouble tracking down how to set an include.

This is what I want the output to be:

top { 
  something {
    include "junk/something.conf"
  }
}

I've got this already:

doc = Hocon::Parser::ConfigDocumentFactory.parse_file("config/application.conf")

And #set_value and #set_config_value seem to work great for basic types, but I can't for the life of me figure out how to set an include within a key's context. I see that non-file includes are not supported, but have a feeling that includes are only supported in the context of reading config files, not writing them.

How can I accomplish this? I've pored over the docs and the code for about an hour and I'm coming up short 😞

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions