https://kotlinlang.org logo
Title
o

olfek

02/18/2021, 7:15 PM
var myVariable : String? = null

fun main(args: Array<String>): Unit {
    myVariable = "Hello World"
    io.ktor.server.netty.EngineMain.main(args)
}

@Suppress("unused") // Referenced in application.conf
@kotlin.jvm.JvmOverloads
fun Application.module(testing: Boolean = false) {
    // myVariable is null here
}
s

spand

02/18/2021, 8:54 PM
Module is loaded in its own class loader
You have to pass it in via the config
o

olfek

02/18/2021, 9:18 PM
Thank you @spand How do I do that?
s

spand

02/19/2021, 11:44 AM
o

olfek

02/19/2021, 1:19 PM
but if I do that, I lose all of the config specified in
application.conf
including
development = true
for hot reload
@spand I have asked the question here https://stackoverflow.com/q/66279393