Reading in Resin.io application environment variables to Java application

I’m building a Java application which is built and started using Gradle. How can I read in my application wide and device specific environment variables and pass them to the Java application?

I.e. I know the environment variables are stored locally on the device in the docker.env file, but how can I extract these and then pass them to the run.sh script?

Thanks in advance!

EDIT SOLVED: Never mind, by using System.getenv(), it pulls in all of the environment variables for you to use in the application.

Hello,

just a quick note: besides the Dockerfile, you can also set environment variables for your application via the dashboard and you can access them in your code. You can read more here: https://docs.resin.io/management/env-vars/#environment-variables

Best,
ilias

Thanks for the response! Yes this is the way I was setting my environment variables, through the Resin Dashboard and then for a Java application, I was able to pull out these enviroments using System.getenv() :slight_smile: