Skip to content

example load with substitutions #67

@kolia

Description

@kolia

Calling Hocon.load on a file containing a substitution such as:

a = yes
b = ${a}

throws an error, and trying some other obvious things don't work either:

1- calling Hocon::ConfigFactory.parse_file(filename) works, but the SimpleConfig object that gets returned has no render method.

2- calling Hocon::Parser::ConfigDocumentFactory.parse_file(filename).resolve() works and has a render method, but does not have a resolve method, so the rendered string show the value of b as being ${a}.

What does work is:

Hocon::ConfigFactory.load_file('test.conf').root()

Which leads me to the issue:

Could the README or the API docs have a paragraph on how to parse config containing substitutions, resolve those substitutions, and then allow you to render the resolved config? Also, is there any reason why Hocon.load does not do this?

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