In terms of negatives, I think the community being...
# ktor
k
In terms of negatives, I think the community being small compared to spring means a lot of gotchas can take longer to debug, some of the documentation is outdated (i.e httpresponse has been deprecated for httpstatement and is still the go to example for http clients), and finally imo supporting multiplatform worries me, is it going to become a master of none jack of all trades type ordeal or will they focus mainly on being a kickass framework for server and clients
b
Totally valid point. However, to be a devil's advocate, I would say that since ktor is mostly reflectionless (a.k.a. no "black magic") means that unexpected issues happen way less frequently.
k
Yeah that no black magic is great in that once u get used to ktor, debugging is pretty chillax
Curious if youre using a HOCON file or init ur config inside the code @Big Chungus . I like how readable HOCON files are although i wish there was 1. A way to inject variables via Hashicorp vault, AWS secret manager, etc in the HOCON file. I was trying to find a way to run code before the HOCON file gets read so u can invoke the api for these secret managers and read them in
And 2. A way to differentiate the env (dev, prod, etc) via multiple HOCON files and their name i.e application-dev.hocon. Spring has this via profiles
l
For setting up variables, I generally set up a CI pipeline for deployment, and I have a script that uses sed to replace variables right before uploading.
For multiple Hocon files: I’ve set this up before, but you have to give up the nicety of EngineMain and set up the startup code yourself.
k
@Landry Norris how do u handle updating variables without having to rekickoff your CI pipeline
Storing config and secrets in vault, k8 secrets, aws secret manager, etc means u can update a secret, bounce the service, and then it will use the latest version
Lets say i use vault. I would prefer a way to hit the vault api and retrieve all the secrets before the server is initialized
l
That is the main downside. I have to restart my CI pipeline whenever I need the variables changed. I have that set up as part of how I handle changes in variables, but that may just be me.
I’ve never used Vault. You may be able to use Ktor Client to retrieve keys in the module function or in the main function if Vault has a REST API.
k
Yeah thats what im doing now (Vault has a REST api) however im looking for a way to hit it and then override what ever is being used to substitute variables in the hocon file
l
I see. I don’t know of any way to do that.
Are these configuration variables all custom or do you also want to change vars that Ktor recognizes? If it’s all custom, you could wrap that in as part of the abstraction.
k
Theres prob a way i gotta read into the ktor code, theyre doing the same concept by allowing u to substitute the application modules as variables in hocon instead of code
All custom yeah, other frameworks like dropwizard and spring allow u to override the variable substitute class with ur own impl (i.e dropwizard: https://github.com/dropwizard/dropwizard/blob/master/dropwizard-configuration/src/main/java/io/dropwizard/configuration/SubstitutingSourceProvider.java)