More explicitly watch for undefined env variables.

This commit is contained in:
mmcwilliams 2020-07-25 11:56:43 -04:00
parent 5caa0d17b2
commit 1d2cc757ec
3 changed files with 9 additions and 9 deletions

View File

@ -11,10 +11,10 @@ const fs_extra_1 = require("fs-extra");
const log = require('../log')('ble');
const wifi_1 = require("../wifi");
const wifi = new wifi_1.Wifi();
const DEVICE_NAME = process.env.DEVICE_NAME || 'intval3';
const SERVICE_ID = process.env.SERVICE_ID || 'intval3_ble';
const CHAR_ID = process.env.CHAR_ID || 'intval3char';
const WIFI_ID = process.env.WIFI_ID || 'wifichar';
const DEVICE_NAME = typeof process.env.DEVICE_NAME !== 'undefined' ? process.env.DEVICE_NAME : 'intval3';
const SERVICE_ID = typeof process.env.SERVICE_ID !== 'undefined' ? process.env.SERVICE_ID : 'intval3_ble';
const CHAR_ID = typeof process.env.CHAR_ID !== 'undefined' ? process.env.CHAR_ID : 'intval3char';
const WIFI_ID = typeof process.env.WIFI_ID !== 'undefined' ? process.env.WIFI_ID : 'wifichar';
const NETWORK = os_1.networkInterfaces(); //?type?
const MAC = getMac() || spoofMac();
//Give the device a unique device name, needs to be in env

File diff suppressed because one or more lines are too long

View File

@ -11,10 +11,10 @@ const log = require('../log')('ble')
import { Wifi } from '../wifi'
const wifi = new Wifi()
const DEVICE_NAME : string = process.env.DEVICE_NAME || 'intval3'
const SERVICE_ID : string = process.env.SERVICE_ID || 'intval3_ble'
const CHAR_ID : string = process.env.CHAR_ID || 'intval3char'
const WIFI_ID : string = process.env.WIFI_ID || 'wifichar'
const DEVICE_NAME : string = typeof process.env.DEVICE_NAME !== 'undefined' ? process.env.DEVICE_NAME : 'intval3'
const SERVICE_ID : string = typeof process.env.SERVICE_ID !== 'undefined' ? process.env.SERVICE_ID : 'intval3_ble'
const CHAR_ID : string = typeof process.env.CHAR_ID !== 'undefined' ? process.env.CHAR_ID : 'intval3char'
const WIFI_ID : string = typeof process.env.WIFI_ID !== 'undefined' ? process.env.WIFI_ID : 'wifichar'
const NETWORK : any = networkInterfaces() //?type?
const MAC : string = getMac() || spoofMac()