make sysinfo provider a setting

This commit is contained in:
Girish Ramakrishnan
2019-10-29 15:46:33 -07:00
parent 7a25187bee
commit 7d987d7c79
19 changed files with 132 additions and 56 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
exports = module.exports = {
getPublicIp: getPublicIp
getServerIp: getServerIp
};
var assert = require('assert'),
@@ -9,7 +9,8 @@ var assert = require('assert'),
superagent = require('superagent'),
util = require('util');
function getPublicIp(callback) {
function getServerIp(config, callback) {
assert.strictEqual(typeof config, 'object');
assert.strictEqual(typeof callback, 'function');
superagent.get('http://169.254.169.254/latest/meta-data/public-ipv4').timeout(30 * 1000).end(function (error, result) {

View File

@@ -1,7 +1,7 @@
'use strict';
exports = module.exports = {
getPublicIp: getPublicIp
getServerIp: getServerIp
};
var assert = require('assert'),
@@ -9,7 +9,8 @@ var assert = require('assert'),
BoxError = require('../boxerror.js'),
superagent = require('superagent');
function getPublicIp(callback) {
function getServerIp(config, callback) {
assert.strictEqual(typeof config, 'object');
assert.strictEqual(typeof callback, 'function');
if (process.env.BOX_ENV === 'test') return callback(null, '127.0.0.1');

View File

@@ -7,12 +7,13 @@
// -------------------------------------------
exports = module.exports = {
getPublicIp: getPublicIp
getServerIp: getServerIp
};
var assert = require('assert');
function getPublicIp(callback) {
function getServerIp(config, callback) {
assert.strictEqual(typeo config, 'object');
assert.strictEqual(typeof callback, 'function');
callback(new Error('not implemented'));

View File

@@ -1,7 +1,7 @@
'use strict';
exports = module.exports = {
getPublicIp: getPublicIp
getServerIp: getServerIp
};
var assert = require('assert'),
@@ -9,7 +9,8 @@ var assert = require('assert'),
superagent = require('superagent'),
util = require('util');
function getPublicIp(callback) {
function getServerIp(config, callback) {
assert.strictEqual(typeof config, 'object');
assert.strictEqual(typeof callback, 'function');
superagent.get('http://169.254.42.42/conf').timeout(30 * 1000).end(function (error, result) {