I have a Play application that contains a Main running another process. At Heroku, it is another dyno running this process.
I need to load the Mode (Dev, Test, Prod) which my Play application is running into the Main process Application, here:
val app: Application = GuiceApplicationBuilder().build().
This is what I have:
object ConsumersApp {
def main(args: Array[String]): Unit = {
val app: Application = GuiceApplicationBuilder()
.loadConfig(env => Configuration.load(env))
.build()
//...
}
}
But .loadConfig(env => Configuration.load(env)) actually returns Mode.Test even when in production environment.
You can pass the
-mainoption to thetarget/universal/stage/bincommand in yourProcfile. For example:I'm not sure if there is a specification for this flag, but the code is on Github