How to read environment variable in a Kotlin application?

I have setup some environment variables to my web application. How can I read them in my Kotlin class?

I have tried System.getEnv("key") but this doesn’t seem to work.

Edit: My bad, it does work!

Hi there,

I recommend consulting the official Kotlin documentation for the best answer. That being said, a brief search brought up this Stack Overflow post that may help point you in the right direction:

Let us know if you have any further questions.


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.