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.