EDIT: My formatting is disabled. We’ll fix it a bit.
We have a small little shell that checks to see if a job is enabled in a specific environment.
Example entry in application.conf
job.myjob.enabled=true %test.job.myjob.enabled=false %prod.job.myjob.enabled=true
etc.
def ifEnabled(property: String)(runnable: => Unit) = play.conf.configuration.getProperty(property + ".enabled", "false") match { case "true" => runnable case _ => Logger info "Ignoring " + property + " since it disabled!" }
Then in your work
class MyJob extends Job { ifEnabled("job.myJob") { // code goes here } }
Thus, you do not need to check each individual environment.
source share