Environments

Ktor doesn’t impose any way for doing this, but here are some guidelines you can use, in case you were wondering about it.

For example:

application.conf:

  1. fun Application.module() {
  2. when {
  3. // Do things only in dev
  4. }
  5. isProd -> {
  6. // Do things only in prod
  7. }
  8. // Do things for all the environments
  9. }
  10. val Application.envKind get() = environment.config.property("ktor.environment").getString()
  11. val Application.isDev get() = envKind == "dev"