Displays host url and ports properly in app settings.

This commit is contained in:
Sean Li 2014-08-28 19:27:56 -07:00
parent 2a547f87c6
commit ed80c00df7
3 changed files with 28 additions and 3 deletions

View File

@ -10,9 +10,19 @@
<label>Host URL</label>
</div>
<div class="col-xs-8">
{{url}}
{{hostUrl}}
</div>
</div>
{{#if ports}}
<div class="row">
<div class="col-xs-3">
<label>Ports</label>
</div>
<div class="col-xs-8">
{{ports}}
</div>
</div>
{{/if}}
<div class="row">
<div class="col-xs-3">
<label>Status</label>

View File

@ -59,6 +59,21 @@ Apps.helpers({
image: function () {
return Images.findOne(this.imageId);
},
hostUrl: function () {
return this.name + '.dev';
},
ports: function () {
var app = this;
if (app.docker && app.docker.NetworkSettings.Ports) {
var ports = _.map(_.keys(app.docker.NetworkSettings.Ports), function (portObj) {
var port = parseInt(portObj.split('/')[0], 10);
return port;
});
return ports.join(', ');
} else {
return null;
}
},
url: function () {
var app = this;
var image = Images.findOne(app.imageId);

View File

@ -94,7 +94,7 @@ runContainer = function (app, image, callback) {
if (err) { callback(err, null); return; }
console.log('Started container: ' + container.id);
// Use dig to refresh the DNS
exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out, code) {
exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out) {
console.log(out);
});
callback(null, container);
@ -147,7 +147,7 @@ restartApp = function (app, callback) {
callback(null);
// Use dig to refresh the DNS
exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out, code) {
exec('/usr/bin/dig dig ' + app.name + '.dev @172.17.42.1 ', function(err, out) {
console.log(out);
});
} else {