Hi, how do I start a native compiled build of ktor...
# ktor
g
Hi, how do I start a native compiled build of ktor with a config file (application.conf)? It doesnt find config files
a
You have to configure the server manually for the nix targets because the module method, which is read from the config, cannot be executed via reflection. Also, you can use only the YAML configuration. Here is an example:
Copy code
val config = YamlConfig("application.yaml")
embeddedServer(CIO, applicationEngineEnvironment {
    connector {
        config?.tryGetString("ktor.deployment.port").let {
            if (it != null) port = it.toInt()
        }
    }

    module {
        routing {
            get("/") {
                call.respondText { "OK" }
            }
        }
    }
}).start(wait = true)
d
Not sure if that helps, but application.conf is only available in intellij ultimate projects. In the community edition you need to use
embeddedServer(...)
in your main function