Search code examples
scalatypesafe-config

how to use typesafe config library just render file content?


I'm use myConfig.root().render(ConfigRenderOptions.concise().setFormatted(true))) print my config content.But I find it contains many other information, such as "version" : "2.4.16", "stdout-loglevel" : "WARNING",etc, which is not defined in my config file.
Where is the info come from?
How can I just print my config file contents?


Solution

  • You're probably using Akka 2.4.16 (directly or indirectly), in which case the "extra" configuration settings are pulled from the reference.conf, as described in the documentation. The reference.conf contains all the default configuration settings, and your application.conf can override any of those settings.

    The ActorSystem merges the reference.conf with your application.conf, as seen here. I don't think there is a way through the Typesafe Config API to render the contents of your application.conf without including the merged settings from reference.conf.