Skip to content

Commit

Permalink
get server ip automatically (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanlantz authored and janpio committed Nov 24, 2018
1 parent 2b3e03f commit 0f1362f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/ParamedicConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ var BROWSERIFY_ARG = '--browserify ';
var DEFAULT_CLI = 'cordova'; // use globally installed cordova by default

var util = require('./utils').utilities;
var ip = require('ip');
var logger = require('./utils').logger;

function ParamedicConfig(json) {
this._config = json;
Expand Down Expand Up @@ -152,7 +154,14 @@ ParamedicConfig.prototype.setPlugins = function (plugins) {
};

ParamedicConfig.prototype.getExternalServerUrl = function () {
return this._config.externalServerUrl;
if (this._config.externalServerUrl) {
return this._config.externalServerUrl;
} else {
// Android emulator defaults to 10.0.0.2 for some reason. If that is needed, it must be passed using the externalServerUrl parameter
var serverIp = "http://" + ip.address();
logger.info("Using local server address = " + serverIp);
return serverIp;
}
};

ParamedicConfig.prototype.isVerbose = function () {
Expand Down

0 comments on commit 0f1362f

Please sign in to comment.