I did some experimenting with kotlin environment v...
# ktor
d
I did some experimenting with kotlin environment variables and encountered some strange behaviour, maybe someone can explain this to me. -According to the explanation at https://ktor.io/servers/configuration/environments.html I can start my program with -PORT to set a specific port and read this variable at runtime with
Copy code
environment.config.property("path.variablename").getString()
-When i start my application with -PORT it starts with the defaultport, when I start it with -port (lowercase) it starts with the set port. In both cases I can't access the variable with
Copy code
environment.config.property("path.variablename").getString()
-When set a variable in the application.conf I can access it on runtime, but not when i need to start the server with a variable. -ktor reads the data with which it was started and creates an application environment, but it was not clear for me how this is done. In the sourcecode ktor reads all variables submitted at start which began with -P: and creates a property from it. My current solution is to submit the needed variables with -P:varname=varvalue and retrieve them with
Copy code
environment.config.property("varname").getString()
Can someone explain to me how to do it the way ktor was intended to start with set environment variables and point out my mistake when trying to access the environment variables? I use IntelliJ IDEA and passed my values as program arguments in the run/debug configuration