some bugs fixed after real world test
some bugs fixed after real world test

file:a/app.js -> file:b/app.js
--- a/app.js
+++ b/app.js
@@ -6,11 +6,14 @@
 var fs = require('fs');
 var array = fs.readFileSync('/etc/default/piBeacon').toString().split("\n");
 for(i in array) {
-	var variabile = array[i].toString().split("=");
-	var key = variabile[0];
-	var val = variabile[1];
-	app[key] = val;
+	if (array[i].toString()) {
+		var variabile = array[i].toString().split('="');
+		var key = variabile[0];
+		var val = variabile[1].replace('"', '');
+		app[key] = val;
+	}
 }
+
 app['INTERVAL'] = app.INTERVAL * 1000;
 app['MACADDRESS'] = require('os').networkInterfaces()['eth0'][0].mac;
 
@@ -69,3 +72,4 @@
 }
 
 module.exports = app
+

--- a/default/piBeacon
+++ b/default/piBeacon
@@ -1,4 +1,5 @@
-DEVICES=1
+DEVICES="1"
 NAME="piBeacon demo"
-SERVER=http://demo.razvi.ro/piBeacon/index.php?type=eddystone-url
-INTERVAL=60
+SERVER="http://demo.razvi.ro/piBeacon/index.php?type=eddystone-url"
+INTERVAL="60"
+

comments