In a Ktor 0.9.3 application, I want to have different .conf
files for different environments, where I extend one main .conf
file. However, I am getting the following exception:
Exception in thread "main" com.typesafe.config.ConfigException$NotResolved: called valueType() on value with unresolved substitutions, need to Config#resolve() first, see API docs
at com.typesafe.config.impl.ConfigDelayedMerge.valueType(ConfigDelayedMerge.java:46)
at com.typesafe.config.impl.SimpleConfig.hasPath(SimpleConfig.java:96)
at io.ktor.config.HoconApplicationConfigKt.tryGetString(HoconApplicationConfig.kt:33)
at io.ktor.server.engine.CommandLineKt$commandLineEnvironment$environment$1.invoke(CommandLine.kt:64)
at io.ktor.server.engine.CommandLineKt$commandLineEnvironment$environment$1.invoke(CommandLine.kt)
at io.ktor.server.engine.ApplicationEngineEnvironmentBuilder.build(ApplicationEngineEnvironment.kt:55)
at io.ktor.server.engine.ApplicationEngineEnvironmentKt.applicationEngineEnvironment(ApplicationEngineEnvironment.kt:38)
at io.ktor.server.engine.CommandLineKt.commandLineEnvironment(CommandLine.kt:50)
at io.ktor.server.netty.DevelopmentEngine.main(DevelopmentEngine.kt:13)
at ApplicationKt.main(application.kt:24)
This is my application.conf
file:
ktor {
deployment {
port = 8080
port = ${?PORT}
watch = [ website ]
}
application {
modules = [ ApplicationKt.module ]
}
}
ui {
hotreload {
enabled = false
path-prefix = "http://localhost:3000"
}
}
And the one extending it that I want to use:
include "application.conf"
ui.hotreload.enabled = true
Any ideas what is going wrong and how to fix it?
According to the issue I opened on Ktor's GitHub page, this is a known bug for which a PR fixing it has been merged already, so it should be fixed in the next release. As a matter of fact, it works as intended in version 0.9.4-alpha-2