How does one handle custom config binding from the...
# ktor
s
How does one handle custom config binding from the app's HOCON? I've read the configuration docs but its not quite clear if/how I can bind arbitrary config values to, for instance a data class.
👀 1
m
IMO ktor's whole config thing is misguided. Do config however you want, and then call
embeddedServer
as you see fit.
For one way to do it, I keep https://bitbucket.org/marshallpierce/ktor-demo/src/master/ around to show such things, but the point is you don't need to use ktor's hocon thing at all.
w
Going with the example here; https://ktor.io/servers/configuration/environments.html You could also initialize a data class, mapping it’s properties to the config values in the environment config
s
Thanks for the insight @mp @Wilfred. I too felt a bit meh after reading how ktor is using HOCON.
👍 1