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.set
request to set{"inbound":60}
, and also have a_sync_inbound_mins
environment variable on the device set to120
, your Notecard will use120
as 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
-1
to reset the value back to its default of0
.
A value of0
means 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
inbound
in the most recenthub.set
request, (60 in the example), or the default value for theinbound
parameter, 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
-1
or0
for theinbound
property does the same thing, or perhaps that0
isn’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