DEV Community

Boilerplate free config in Kotlin using Hoplite

Stephen Samuel on August 06, 2019

TL;DR: Loading Yaml, Json, etc config files into Kotlin data classes without boilerplate and with error checking with Hoplite. Hello Kotl...
Collapse
 
jantypas profile image
John Antypas

Sir, I admit I may be slow, but I created a file (.toml) and placed it in /tmp/configfile.toml. I used the example code to do a loadConfigorThrow per your example.
The code compiles, and attempts to run, but, it informs me it can't open /tmp/configfile.toml.
OK, I see the file there, I see it is 0644 so anyone can read it. How can I tell WHY Hoplite can't open it or read it?

Collapse
 
asafmesika profile image
asaf mesika

Amazing work! Are you working internally with LightBend config?

Collapse
 
sksamuel profile image
Stephen Samuel

The hoplite-hocon library wraps lightbend yes. The others wrap different libraries like jackson or snake yaml.