Is it possible to read a configuration property as...
# ktor
j
Is it possible to read a configuration property as an integer? Asking because in this example we are reading an integer as a string:
Copy code
ktor {
    deployment {
        port = 8080
    }
}
Copy code
val port = environment.config.propertyOrNull("ktor.deployment.port")?.getString() ?: "8080"
Since Ktor uses HOCON, which is a typed structure, I thought it would be possible to read properties as specific types like this:
Copy code
val port = environment.config.propertyOrNull("ktor.deployment.port")?.getInt() ?: 8080
👀 1
h
environment.config.property("ktor.deployment.port").getString().toInt()
j
Thought I could avoid casting the value 🤔
a
Ktor doesn't support out-of-the-box parsing for the property values.
j
Alright, thank you 🙂