jooby-project / jooby

The modular web framework for Java and Kotlin
https://jooby.io
Apache License 2.0
1.68k stars 199 forks source link

How to set application environment when using joobyRun? #3438

Closed nonetallt closed 1 month ago

nonetallt commented 1 month ago

Question

Is it possible to set the application environment when executing the application via ./gradlew joobyRun?

There's an example in the docs for java -jar myapp.jar application.env=foo but I couldn't find any way of passing the argument to joobyRun task. Based on the JoobyRunOptions class in the module source code, I guess application.env is not one of the supported options?

How should I set the environment to use my local testing configuration while using joobyRun?

jknack commented 1 month ago

Try with JVM variable: ./gradlew -Dapplication.env=dev joobyRun

nonetallt commented 1 month ago

Try with JVM variable: ./gradlew -Dapplication.env=dev joobyRun

Thank you.

I tried running ./gradlew -Dapplication.env=local joobyRun but ended up with error: Task '.env=local' not found in root project.

I managed to fix this by quoting the variable: ./gradlew -D"application.env=local" joobyRun.