From 4e7b017bb5f5051bf0fedae65eb27ebcf5ee1db1 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Fri, 22 Aug 2014 07:40:23 -0700 Subject: [PATCH] Store provisioned IP in config.js --- config.js | 1 + src/server.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 5b5f68bc8..5f5dde3eb 100644 --- a/config.js +++ b/config.js @@ -61,6 +61,7 @@ config.save = function () { config.token = null; config.nakedDomain = null; + config.ip = null; mkdirp.sync(config.baseDir); config.save(); diff --git a/src/server.js b/src/server.js index ca8f13593..9f9ab42db 100644 --- a/src/server.js +++ b/src/server.js @@ -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 () {