https://kotlinlang.org logo
#ktor
Title
# ktor
k

keochris

08/15/2019, 3:07 PM
Hello, sorry for the noob question (new to Kotlin and JVM world). After succeeding in generating a working fat jar file with Shadowjar, I’d like to know how I can create an external config file to be used with that fat jar so that parameters can be read from that external file. Something similar to the application.conf but not in the jar itself so that we can amend the values whenever needed. Thanks for your help !
d

Dico

08/16/2019, 11:20 PM
Use any serialisation framework to read yaml or json file
Or toml
You can even write a one liner to read ini format
Frameworks that come to mind - Jackson databind, Gson, kotlinx serialisation, many more
k

keochris

08/18/2019, 6:55 PM
Thank you for leading to the right direction Dico ! I’ll give a try to YAML and SnakeYAML. 👍
k

kqr

08/22/2019, 1:46 PM
isnt something like this you are looking for https://ktor.io/servers/configuration.html?
k

keochris

08/26/2019, 12:14 PM
Actually, yes, it looks closer to what I was thinking of. Basically I should use an HOCON file that will be located in a place that can be called by adding a parameter with a switch when calling the jar. Is that what you thought of?
k

kqr

09/06/2019, 8:04 AM
yes
3 Views