From 4eb20e0e577de74f552b69515ea7ece5ab567906 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Tue, 18 Jul 2017 07:41:19 +0200 Subject: [PATCH] refactor(repositoryWorker): Separate token from config --- lib/workers/global/index.js | 2 +- lib/workers/repository/apis.js | 4 ++-- lib/workers/repository/index.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/workers/global/index.js b/lib/workers/global/index.js index 66168587ba..f87a55d244 100644 --- a/lib/workers/global/index.js +++ b/lib/workers/global/index.js @@ -17,7 +17,7 @@ async function start() { for (let index = 0; index < config.repositories.length; index += 1) { const repoConfig = module.exports.getRepositoryConfig(config, index); repoConfig.logger.info('Renovating repository'); - await repositoryWorker.renovateRepository(repoConfig); + await repositoryWorker.renovateRepository(repoConfig, repoConfig.token); repoConfig.logger.info('Finished repository'); } if (config.repositories.length === 0) { diff --git a/lib/workers/repository/apis.js b/lib/workers/repository/apis.js index d236e18506..df7e9f73b3 100644 --- a/lib/workers/repository/apis.js +++ b/lib/workers/repository/apis.js @@ -28,7 +28,7 @@ async function setNpmrc(config) { } } -async function initApis(inputConfig) { +async function initApis(inputConfig, token) { function getPlatformApi(platform) { if (platform === 'github') { return githubApi; @@ -42,7 +42,7 @@ async function initApis(inputConfig) { config.api = getPlatformApi(config.platform); await config.api.initRepo( config.repository, - config.token, + token, config.endpoint, config.logger ); diff --git a/lib/workers/repository/index.js b/lib/workers/repository/index.js index 00db34770c..9c3c4eb2cf 100644 --- a/lib/workers/repository/index.js +++ b/lib/workers/repository/index.js @@ -10,13 +10,13 @@ module.exports = { renovateRepository, }; -async function renovateRepository(packageFileConfig) { - let config = Object.assign({}, packageFileConfig); +async function renovateRepository(repoConfig, token) { + let config = Object.assign({}, repoConfig); config.errors = []; config.warnings = []; config.logger.trace({ config }, 'renovateRepository'); try { - config = await apis.initApis(config); + config = await apis.initApis(config, token); config = await apis.mergeRenovateJson(config); if (config.enabled === false) { config.logger.debug('repository is disabled');