How would I pass environment variables so that they’re substituted into the typesafe/hocon config files?
For example, I’m trying to do
collectorPort=8080 ./snowplow-stream-collector-0.7.0 --config ~/downloads/collector.conf
So that I can change the port for dev, test and prod environments.
The error raised is
Exception in thread "main" com.typesafe.config.ConfigException$NotResolved: port has not been resolved, you need to call Config#resolve(), see API docs for Config#resolve()
But nowhere in the code does resolve() get called so I think substitution is just not going to work at all.
The typesafe docs recommend using ConfigFactory.load() because it will call resolve for you whereas we’re only doing a parse. I’ll try to submit a PR if it works.
Thanks @Shin! Much appreciated…
Thx @Shin, i actually tried to do exactly that, but i always thought, i was doing it wrong. So i gave up on environment variables.