Tweaks to config options handling after review

This commit is contained in:
Tim Perry 2018-07-17 15:38:38 +02:00
parent 36eb0a108e
commit 70be2ae596

View File

@ -15,7 +15,6 @@ limitations under the License.
*/ */
import Promise = require('bluebird'); import Promise = require('bluebird');
import ResinSdk = require('resin-sdk'); import ResinSdk = require('resin-sdk');
import _ = require('lodash');
import deviceConfig = require('resin-device-config'); import deviceConfig = require('resin-device-config');
import * as semver from 'resin-semver'; import * as semver from 'resin-semver';
@ -25,13 +24,12 @@ export function generateBaseConfig(
application: ResinSdk.Application, application: ResinSdk.Application,
options: { version?: string; appUpdatePollInterval?: number }, options: { version?: string; appUpdatePollInterval?: number },
) { ) {
options = _.mapValues(options, function(value, key) { if (options.appUpdatePollInterval) {
if (key === 'appUpdatePollInterval') { options = {
return options[key]! * 60 * 1000; ...options,
} else { appUpdatePollInterval: options.appUpdatePollInterval * 60 * 1000,
return value; };
} }
});
return Promise.props({ return Promise.props({
userId: resin.auth.getUserId(), userId: resin.auth.getUserId(),