Clearing fleet-wide environment variables for a specific device


In my app I’ve made a mechanism to obtain configuration from a config file.
When the same configuration option is set in an environment variable, it will override the value from the config file.
This works beautifully.

While testing some things with my development device, I wanted to clear one of the fleet-wide variables, but hit a snag.

I couldn’t undefine/delete the variable, as it fell back to the fleet-wide value.
I also couldn’t set an empty value for the variable (interface won’t let me).

The workaround during development is easy, I can just unset or clear the variable on the command line before calling my application, but obviously this won’t work when the device is running standalone.

This made me wonder what the proper approach would be to unset or clear a fleet-wide environment variable for a specific device.

One option I can think of is to set the variable to only whitespace and trim the value when checking whether it’s set. You’d still have the variable defined, but its value is effectively cleared.

Thanks for raising this. Yes, I think you will have to use the work-around for now since we do not support unsetting a fleet-wide variable for a specific device(s). I have recorded this requirement as a ‘pattern’ in our internal system.
I would suggest defining a fixed string that represents a cleared variable rather than setting vars to whitespace. So, setting vars to something like '__CLEARED_VAR__' and checking this string inside application code would be more maintainable than setting them to a whitespace (which would be difficult to grep/log/visually inspect). Just my 2 cents :slight_smile:

Best regards,

Thanks for coming back to me on this one.
It’s nice to have confirmation that this is currently not implemented, but is being discussed.

I agree the predefined string is more maintainable than just the whitespace, I’ll probably end up with two predefined strings for now, one for empty value and one for unset.