Hi, I am using Ktor config and face the problem wi...
# ktor
t
Hi, I am using Ktor config and face the problem with the application when it build by
gradlew installDist
. The Ktor application will not be able to read the environment variable from the cloud system. But if we build the Ktor application with
fatJar
, then the application can read the env variables.
Copy code
ENVIRONMENT = LOCAL
ENVIRONMENT = ${?APPLICATION_ENV}
The above example from a HOCON file, if the cloud provide a APPLICATION_ENV, then the Ktor config can not read this property.
1
a
Can you try reading the environment variable with
System.getenv
method to see if the problem is with Ktor?
t
we have found the solution at the end. Looks like ConfigFactory.parseResources by default only will load systemProperties and not systemEnvironment, therefore when we deploy our application on the cloud, some of the properties can not be injected.