Hello everyone. I’m implementing microservice using Ktor for the very first time, and I’ve faced with one issue.
Can I have env variable placeholder within some string in yaml / hocon config?
E.g.
Official documentation says that if should work, but all examples are about to define whole property as potential env variable, e.g.
port = ${PORT}
And it seems like it works in this case… But I wonder if there is no way to make it work when env variable is in the middle of property? The only way to have it like that is to move configurations into code?
m
Mark Lanett
11/01/2023, 9:08 PM
We use sigil to make this work. Run script calls
sigil -pf config.template > config.ini
and then actually launches the service.
d
dave08
11/19/2023, 3:26 AM
You can give #hoplite a try for a much more powerful configs solution... we use it in all our ktor microservices, it probably covers your case, but it also allows layered configs.