Hi Dominik,
Thanks for your reply. I thought so as well. But I am having some problems with passing program args.
Currently, i have the following:
object Configs {
lazy val CONFIG: Config = ConfigFactory.load()
lazy val config1: String = CONFIG.getString("key1")
lazy val config2: String = CONFIG.getString("key2")
lazy val config3: String = CONFIG.getString("key3")
...
}
If I pass the application.conf as program args, it will be like this:
object Configs {
def setup(file: String): Unit = CONFIG = ConfigFactory.parseFile(new File(file))
var CONFIG: Config = _
lazy val config1: String = CONFIG.getString("key1")
lazy val config2: String = CONFIG.getString("key2")
lazy val config3: String = CONFIG.getString("key3")
...
}
This Scala code is not looking good I think.
- The CONFG is var instead of val
- I have to call setup every time
- I have some other object or vals which initialised depending on the parameters. If the parameters are passed in as program args instead of from JVM option, these object vals cannot be initialised properly.
And ideas about it? Many Thanks :)
Best regards/祝好,
Chang Liu 刘畅
Hey,
I don't think that it's possible per job. You can pass only program arguments but not JVM options.
Regards,
Dominik.