Skip to content

Commit

Permalink
#231: Better linux host IP discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Aug 2, 2017
1 parent d63bb51 commit 5d9b1e3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
8 changes: 1 addition & 7 deletions lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,8 @@ lando.events.on('pre-bootstrap', 1, function(config) {
var rip = '192.168.65.1';

// If on linux we are dealing with something else
// @TODO: this might need some love
if (process.platform === 'linux') {
var os = require('os');
var nics = os.networkInterfaces();
var lo = '127.0.0.1';
var ip = _.dropRight(_.get(nics, 'eth0[0].address', lo).split('.'));
ip.push('1');
rip = ip.join('.');
rip = lando.node.ip.address();
}

// Set some helpful engine env helpers
Expand Down
11 changes: 11 additions & 0 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ exports.chalk = require('yargonaut').chalk();
*/
exports.fs = require('fs-extra');

/**
* Get ip utils
*
* @since 3.0.0
* @example
*
* // Get the ip module
* var ip = lando.node.ip;
*/
exports.ip = require('ip');

/**
* Get object-hash
*
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"fs-extra": "^0.18.2",
"github": "^9.2.0",
"inquirer": "^3.1.1",
"ip": "^1.1.5",
"js-yaml": "^3.4.6",
"jsonfile": "^2.4.0",
"kalabox-stats-client": "^0.2.1",
Expand Down
8 changes: 4 additions & 4 deletions plugins/lando-proxy/lib/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ module.exports = function(lando) {
var https = ports.https;

// Log
lando.log.verbose('Proxying on %s:%s', engineHost, http);
lando.log.verbose('Proxying on %s:%s', engineHost, https);
lando.log.verbose('Proxying on %s:%s', http);
lando.log.verbose('Proxying on %s:%s', https);

// Proxy service
var proxy = {
Expand All @@ -213,8 +213,8 @@ module.exports = function(lando) {
},
networks: ['edge'],
ports: [
[engineHost, http, '80'].join(':'),
[engineHost, https, '443'].join(':'),
[http, '80'].join(':'),
[https, '443'].join(':'),
[proxyDash, 8080].join(':')
],
volumes: [
Expand Down

0 comments on commit 5d9b1e3

Please sign in to comment.