# server

Dmitrii Vovnei

10/31/2023, 9:06 AM
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.
Copy code
url = "<https://my-awesome-platform>-${ENVIRONMENT}".
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?

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.


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.