Fix issue where network settings were not used by config generate

Change-Type: patch
This commit is contained in:
Tim Perry 2017-11-14 13:46:52 +01:00
parent 2a2d621d6a
commit f7075d7db9
2 changed files with 20 additions and 4 deletions

View File

@ -18,10 +18,18 @@ limitations under the License.
var authenticateWithApplicationKey, authenticateWithDeviceKey;
exports.generateBaseConfig = function(application, options) {
var Promise, deviceConfig, resin;
var Promise, _, deviceConfig, resin;
Promise = require('bluebird');
_ = require('lodash');
deviceConfig = require('resin-device-config');
resin = require('resin-sdk-preconfigured');
options = _.mapValues(options, function(value, key) {
if (key === 'appUpdatePollInterval') {
return value * 60 * 1000;
} else {
return value;
}
});
return Promise.props({
userId: resin.auth.getUserId(),
username: resin.auth.whoami(),
@ -48,12 +56,12 @@ exports.generateBaseConfig = function(application, options) {
mixpanel: {
token: results.mixpanelToken
}
});
}, options);
});
};
exports.generateApplicationConfig = function(application, options) {
return exports.generateBaseConfig(application).tap(function(config) {
return exports.generateBaseConfig(application, options).tap(function(config) {
return authenticateWithApplicationKey(config, application.id);
});
};

View File

@ -16,9 +16,16 @@ limitations under the License.
exports.generateBaseConfig = (application, options) ->
Promise = require('bluebird')
_ = require('lodash')
deviceConfig = require('resin-device-config')
resin = require('resin-sdk-preconfigured')
options = _.mapValues options, (value, key) ->
if key == 'appUpdatePollInterval'
value * 60 * 1000
else
value
Promise.props
userId: resin.auth.getUserId()
username: resin.auth.whoami()
@ -42,9 +49,10 @@ exports.generateBaseConfig = (application, options) ->
pubnub: results.pubNubKeys
mixpanel:
token: results.mixpanelToken
, options
exports.generateApplicationConfig = (application, options) ->
exports.generateBaseConfig(application)
exports.generateBaseConfig(application, options)
.tap (config) ->
authenticateWithApplicationKey(config, application.id)