Closed ddebrecenijr closed 1 year ago
Because classpath is a Java concept, I used modulepath to make it more specific to Node.js. Your example should work If you change classpath to modulepath. I will add classpath as an alias of modulepath later this week.
I see. That makes sense.
Locally, I could not get modulepath
to work, but my use case wouldn't support that anyways. I have a Go application that uses parse-hocon
in order to read some specific settings, such as the port number of a service, that I want to start via docker.
That same service (Scala) also reads the configuration file on startup, but is using Lightbend's Typesafe Config for loading. There modulepath wouldn't be recognized unfortunately.
I'm not using the library that is available for Go because that has its own issues 😅
resolved by 28684ae.
According to the Hocon Spec you should be able to use
classpath()
for classpath resources. But if you were to test this with a small example like so:myconf.conf
lib/common.conf
With an execution of
$ parse-hocon myconf.conf
, you will get the errorInvalid component 'classpath'
I did a little digging into the source code and (pardon my JS) it seems that adding
classpath
to theFLAGS
const inContext.js
would get you partially there. It'll attempt to use theFileSource
component. However, I am guessing that a custom component is required to get it working correctly, similarly toModulepathSource
.