Can I change application.mode at runtime, eg. with an environment variable?

I have some routes in my Play application which we use for local development but don’t want to expose in production. We achieve this by verifying the value of application.mode:

        if (env.mode != Mode.Dev) {
          throw new AccessDenied("This route is only accessible in dev")
        }

I need to access these routes in an integration test, in which we run the play application using docker-compose after it has been built using sbt stage. Is there any way to make it start in dev mode at this point?

I’ve tried adding to JAVA_OPTS but this didn’t seem to work:

- JAVA_OPTS=-Xms5g -Xmx5g -XX:+UseG1GC -Dapplication.mode=dev

Is it possible to explicitly set the application mode either preferably at runtime, or less ideally for us at build time?