Store provisioned IP in config.js

This commit is contained in:
Johannes Zellner
2014-08-22 07:40:23 -07:00
parent 8b4a4b052d
commit 4e7b017bb5
2 changed files with 4 additions and 2 deletions
+1
View File
@@ -61,6 +61,7 @@ config.save = function () {
config.token = null;
config.nakedDomain = null;
config.ip = null;
mkdirp.sync(config.baseDir);
config.save();
+3 -2
View File
@@ -112,7 +112,7 @@ Server.prototype._getConfig = function (req, res) {
res.send(200, {
appServerUrl: config.appServerUrl,
fqdn: config.fqdn,
ip: '127.0.0.1',
ip: config.ip,
version: pkg.version
});
};
@@ -155,6 +155,7 @@ Server.prototype._provision = function (req, res, next) {
if (!req.body.appServerUrl) return next(new HttpError(400, 'No appServerUrl provided'));
if (!req.body.adminOrigin) return next(new HttpError(400, 'No adminOrigin provided'));
if (!req.body.fqdn) return next(new HttpError(400, 'No fqdn provided'));
if (!req.body.ip) return next(new HttpError(400, 'No ip provided'));
debug('_provision: received from appstore ' + req.body.appServerUrl);
@@ -162,7 +163,7 @@ Server.prototype._provision = function (req, res, next) {
if (config.token) return next(new HttpError(409, 'Already provisioned'));
config.set(_.pick(req.body, 'token', 'appServerUrl', 'adminOrigin', 'fqdn'));
config.set(_.pick(req.body, 'token', 'appServerUrl', 'adminOrigin', 'fqdn', 'ip'));
// override the default webadmin OAuth client record
clientdb.del('webadmin', function () {