pixl-config 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.js +6 -12
- package/package.json +1 -1
package/config.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
var fs = require("fs");
|
|
7
7
|
var cp = require("child_process");
|
|
8
|
-
var dns = require("dns");
|
|
9
8
|
var os = require('os');
|
|
10
9
|
|
|
11
10
|
var Class = require("pixl-class");
|
|
@@ -245,7 +244,6 @@ var Config = module.exports = Class.create({
|
|
|
245
244
|
|
|
246
245
|
getIPAddress: function(callback) {
|
|
247
246
|
// determine server ip address
|
|
248
|
-
var self = this;
|
|
249
247
|
|
|
250
248
|
// allow the config to override this
|
|
251
249
|
this.ip = this.get('ip');
|
|
@@ -256,7 +254,7 @@ var Config = module.exports = Class.create({
|
|
|
256
254
|
}
|
|
257
255
|
|
|
258
256
|
// try OS networkInterfaces()
|
|
259
|
-
// find the first external IPv4 address that doesn't match 169.254.*
|
|
257
|
+
// find the first external IPv4 address that doesn't match 127.* or 169.254.*
|
|
260
258
|
var ifaces = os.networkInterfaces();
|
|
261
259
|
var addrs = [];
|
|
262
260
|
for (var key in ifaces) {
|
|
@@ -268,8 +266,8 @@ var Config = module.exports = Class.create({
|
|
|
268
266
|
var iaddrs = Tools.findObjects( addrs, { family: 'IPv4', internal: false } );
|
|
269
267
|
for (var idx = 0, len = iaddrs.length; idx < len; idx++) {
|
|
270
268
|
var addr = iaddrs[idx];
|
|
271
|
-
if (addr && addr.address && addr.address.match(/^\d+\.\d+\.\d+\.\d+$/) && !addr.address.match(/^169\.254\./)) {
|
|
272
|
-
// found an interface that is not 169.254.* so go with that one
|
|
269
|
+
if (addr && addr.address && addr.address.match(/^\d+\.\d+\.\d+\.\d+$/) && !addr.address.match(/^127\./) && !addr.address.match(/^169\.254\./)) {
|
|
270
|
+
// found an interface that is not 127.* or 169.254.* so go with that one
|
|
273
271
|
this.ip = addr.address;
|
|
274
272
|
callback();
|
|
275
273
|
return;
|
|
@@ -277,19 +275,15 @@ var Config = module.exports = Class.create({
|
|
|
277
275
|
}
|
|
278
276
|
|
|
279
277
|
var addr = iaddrs[0];
|
|
280
|
-
if (addr && addr.address && addr.address.match(/^\d+\.\d+\.\d+\.\d+$/)) {
|
|
278
|
+
if (addr && addr.address && addr.address.match(/^\d+\.\d+\.\d+\.\d+$/) && !addr.address.match(/^127\./)) {
|
|
281
279
|
// this will allow 169.254. to be chosen only after all other non-internal IPv4s are considered
|
|
282
280
|
this.ip = addr.address;
|
|
283
281
|
callback();
|
|
284
282
|
return;
|
|
285
283
|
}
|
|
286
284
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
// if (err) callback(err);
|
|
290
|
-
self.ip = addresses ? addresses[0] : '127.0.0.1';
|
|
291
|
-
callback();
|
|
292
|
-
} );
|
|
285
|
+
this.ip = '127.0.0.1';
|
|
286
|
+
callback();
|
|
293
287
|
},
|
|
294
288
|
|
|
295
289
|
setPath: function(path, value) {
|