Read Device Variables, without having to restart the service

I’m maintaining a Node.js application running on Raspbery pi 3. The Pi’s are playing audio 24/7 - and I would like to control the volume through the environment variables.

It’s working, but every time I update a device variable, the service restarts(!).

Is this something that could be changed from Balenas side, or would there be another way? I the past I used to read the volume setting from a database, but it seems like overkill. The best part is no part :sweat_smile:

Hey Alex,

Changing environment variables will restart the container(s) by design, to bring the new value into the container environment. It’s not something we can, or want to, stop happening.

In order to change values in your node application, the simplest way would be to implement an API using express. You can find an example here :

Another is here :

Notice that this second example is balenaSound setting the volume of the underlying audio balenaBlock. It may be worth you investigating if you can change your application to use the block. :slight_smile:

Hope this helps,

Roger :+1: I will use the API approach then