Read the full blog post at https://blues.dev/blog/changing-notecard-config-with-env-vars and continue the discussion here.
This is great! I didn’t know about the reserved environment variables for controlling sync behavior.
For example, if you use a Notecard’s
hub.setrequest to set{"inbound":60}, and also have a_sync_inbound_minsenvironment variable on the device set to120, your Notecard will use120as an inbound interval.
If you delete any of these variables your device will revert back to its default configuration.
On deleting the environment variable, does that mean the notecard would revert to what was set for inbound in the most recent hub.set request, (60 in the example), or the default value for the inbound parameter, which is 0?
Use
-1to reset the value back to its default of0.
A value of0means that the Notecard will never sync inbound data unless explicitly told to do so (e.g. usinghub.sync).
(from hub.set API docs)
Does that mean that setting -1 or 0 for the inbound property does the same thing, or perhaps that 0 isn’t a valid value to set?
Hey @devElert,
On deleting the environment variable, does that mean the notecard would revert to what was set for
inboundin the most recenthub.setrequest, (60 in the example), or the default value for theinboundparameter, which is0?
The environment variable doesn’t change your hub.set configuration.
When the Notecard sets its next synchronization interval it checks for the environment variable first. If no variable is present, it falls back to the hub.set request’s current inbound value. If inbound has never been set, it’ll use the default of 0.
Does that mean that setting
-1or0for theinboundproperty does the same thing, or perhaps that0isn’t a valid value to set?
They do the same thing. The -1 value is a standard way to reset numeric arguments throughout the Notecard’s API Essential Requests - Blues Developers.
TJ