diff --git a/bin/dpd b/bin/dpd index 871cb02..b1451ef 100755 --- a/bin/dpd +++ b/bin/dpd @@ -328,8 +328,14 @@ program d.package(tar, function (err) { if(err) return console.error(err); console.log('pushing...'); - d.publish('http://deploy.deploydapp.com:3003', tar, key, function (err) { - if(err) return console.error('failed to push:', err.message || 'could not push app to ' + DPDAPP_URL); + d.publish('http://cloud.deployd.com', tar, key, function (err) { + if(err) { + if (err.statusCode === 401) { + d.setConfig('sid', undefined); + d.setConfig('user', undefined); + } + return console.error('failed to push:', err.message || 'could not push app to ' + DPDAPP_URL); + } console.log('deployd app to http://' + d.subdomain + '.deploydapp.com!'); }); }); diff --git a/lib/client/deploy.js b/lib/client/deploy.js index af20aca..d3fcdd8 100644 --- a/lib/client/deploy.js +++ b/lib/client/deploy.js @@ -15,8 +15,8 @@ var path = require('path') function Deployment(appPath, user, subdomain) { var remote = this.remote = 'deploydapp.com'; - this.api = "http://api.deploydapp.com:3000"; - this.deployUrl = "http://deploy.deploydapp.com:3003"; + this.api = "http://api.deployd.com"; + this.deployUrl = "http://cloud.deployd.com"; this.path = path.resolve(appPath); @@ -100,7 +100,12 @@ Deployment.prototype.publish = function (url, tar, key, callback) { function done(err, res, body) { if(err) return callback(err); - if(res.statusCode >= 400) return callback(new Error(body)); + + if(res.statusCode >= 400) { + var error = new Error(body); + error.statusCode = res.statusCode; + return callback(error); + } callback(null, deployment.getConfig(deployment.configKey())); } @@ -119,12 +124,7 @@ Deployment.prototype.publish = function (url, tar, key, callback) { return callback(err); } - if(res.statusCode !== 200) { - deployment.setConfig('sid', undefined); - deployment.setConfig('user', undefined); - delete deployment.sid; - delete deployment.user; - } else { + if(res.statusCode === 200) { try { body = JSON.parse(body); @@ -227,6 +227,7 @@ Deployment.prototype.getCurrentUser = function(fn) { jar: false }, function(err, res, user) { if (err) return fn(err); + if (res.statusCode === 404) return fn(new Error("Could not connect")); if (user) user = JSON.parse(user); if (!user) return fn(new Error("Not authenticated")); fn(null, user); diff --git a/lib/internal-resources/dashboard/deployments.html b/lib/internal-resources/dashboard/deployments.html index 0273474..5c6c79d 100644 --- a/lib/internal-resources/dashboard/deployments.html +++ b/lib/internal-resources/dashboard/deployments.html @@ -1,9 +1,15 @@