Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #467 from Financial-Times/vault-shared-patch
Browse files Browse the repository at this point in the history
Only include shared keys an application specifies
  • Loading branch information
sjparkinson authored Jun 28, 2017
2 parents 8f3d946 + 238f31f commit 3319717
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tasks/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3319717

Please sign in to comment.