Hi Small question about <development mode> : Is it...
# ktor
j
Hi Small question about development mode : Is it possible to let ktor decide which modules to load based on development mode ? If not is it possible with a custom property in the conf like in the example: https://ktor.io/docs/configurations.html#custom-property ? Thanks
a
Is it possible to let ktor decide which modules to load based on development mode ?
No. The best thing you can do is to wrap a module's code with a check for the
developmentMode
or custom property condition. Here is an example:
Copy code
embeddedServer(Netty, applicationEngineEnvironment {
    connector {
        port = 7070
    }

    module {
        if (developmentMode) {
            routing {
                get("/") {
                    call.respondText { "You will see it in the development mode" }
                }
            }
        }
    }
}).start()
j
Thanks @Aleksei Tirman [JB] - do you know it possible to pass which hocon file to use in the command line ? or maybe some feature like spring config profiles? so we can set some of the configuration to be enable in certain cases ? Thanks again
a
You can use
-config
CLI argument to specify the path to a HOCON file.
j
thanks
a
or maybe some feature like spring config profiles?
I don't know about such a feature.