fix: When reporting initial config, avoid creating a "VPN enabled" unnecessary override

Since we were comparing the VPN's value before adding the explicit "true", there were cases
were the VPN is off, and therefore "value" didn't match the default, so the supervisor would
create a device specific SUPERVISOR_VPN_CONTROL = true, which is unnecessary and causes issues if
users don't expect this and move the device to an app that has VPN disabled. The correct behavior
is to compare "varValue" and only create a device config var if this value differs from the default.

(This was the behavior before the TS conversion in 01ed7bb103 )

Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
This commit is contained in:
Pablo Carranza Velez 2019-06-28 15:09:46 -07:00
parent 90e7ec0053
commit 743c8406c9

View File

@ -708,7 +708,7 @@ export class APIBinder {
varValue = 'true';
}
if (targetConfig[key] == null && value !== defaultConfig[key]) {
if (targetConfig[key] == null && varValue !== defaultConfig[key]) {
const envVar = {
value: varValue,
device: deviceId,