From 238f31fdeee045b98e6e586d46516befb05ae597 Mon Sep 17 00:00:00 2001 From: Samuel Parkinson Date: Tue, 27 Jun 2017 18:17:26 +0100 Subject: [PATCH] Only include shared keys an application specifies. --- tasks/configure.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tasks/configure.js b/tasks/configure.js index 7a9c8698..3610324d 100644 --- a/tasks/configure.js +++ b/tasks/configure.js @@ -37,10 +37,22 @@ function fetchFromVault (source, target, registry = DEFAULT_REGISTRY_URI) { .then(([path, vault]) => { return Promise.all([ vault.read('secret/teams/next/shared/production'), - vault.read(`${path}/production`) + vault.read(`${path}/production`), + vault.read(`${path}/shared`) ]); }) - .then(([globals, app]) => Object.assign({}, globals.data, app.data)); + .then(([sharedVars, appVars, appShared]) => { + // Only include globals the application needs. + const shared = appShared.data.env.reduce((shared, key) => { + if (key in sharedVars.data) { + shared[key] = sharedVars.data[key]; + } + + return shared; + }, {}); + + return Object.assign({}, shared, appVars.data); + }); } function task (opts) {