How can I seperate logback.xml and logback-test.xml when building rest-api with Ktor? With SpringBoot you can seperate easily and set profile. But how to do it in Ktor?
Thanks for help.
How can I seperate logback.xml and logback-test.xml when building rest-api with Ktor? With SpringBoot you can seperate easily and set profile. But how to do it in Ktor?
Thanks for help.
Maybe it's too late but I had the same problem. I solved that by defining different resources for each environment. You can also have different code per environment. Here is a part of my build.gradle.ktx
val environment: String by project
sourceSets {
val main by getting {
when (environment) {
"dev" -> {
java.srcDirs("src/main/kotlin", "src/main/dev")
resources.srcDirs("src/main/dev/resources")
}
"prod" -> {
java.srcDirs("src/main/kotlin", "src/main/prod")
resources.srcDirs("src/main/prod/resources")
}
else -> {
throw Exception("Please provide 'Environment' variable prod or dev")
}
}
}
}
the default environment can be set in gradle.properties file
environment=dev
also the environment parameter can be passed to gradle run eg:
run -Penvironment=dev