Search code examples
javascalaconfigconfiguration-files

Access fully parsed config in typesafe config


Given a appplication.config which contains fixed values and optional overwrites as for example like this:

  timeout.seconds = 30
  timeout.seconds=${?SSO_TIMEOUT_SECONDS}

using com.typesafe.config

which function does return the config with fully parsed entries?

e.g

timeout.seconds = 99

if it has been set externally otherwise the default value. NOT returned should be the config with preset values AND optional replacements.

I tested

ConfigFactory.defaultApplication()

but that does return both. Although the description makes me think it would not.


Solution

  • You can load the default config using

    ConfigFactory.load()
    

    This will replace any substitutions with the appropriate values.