Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Lengelsen committed Sep 7, 2020
1 parent 11de83f commit edfa5b4
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 190 deletions.
14 changes: 7 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DOCKER = new require("dockerode")();
const DOCKER = new require('dockerode')();
let vault;

module.exports = async (
Expand All @@ -9,9 +9,9 @@ module.exports = async (
secretName
) => {
const OPTIONS = { endpoint: vaultEndpoint };
vault = require("node-vault")(OPTIONS);
vault = require('node-vault')(OPTIONS);
try {
const jsonString = await require("fs").promises.readFile(approleFile);
const jsonString = await require('fs').promises.readFile(approleFile);
const approleJson = JSON.parse(jsonString);
const loginResponse = await vaultApproleLogin(approleJson);
const vaultSecret = await readVaultSecret(vaultPath, loginResponse);
Expand All @@ -23,8 +23,8 @@ module.exports = async (

async function vaultApproleLogin(approleJson) {
const APPROLE = {
role_id: approleJson.roleId,
secret_id: approleJson.secretId
role_id: approleJson.role_id,
secret_id: approleJson.secret_id,
};
return vault.approleLogin(APPROLE);
}
Expand All @@ -35,10 +35,10 @@ async function readVaultSecret(vaultPath, loginResponse) {
}

async function createDockerSecretFromValue(vaultKey, vaultSecret, secretName) {
const VALUE = Buffer.from(vaultSecret.data.data[vaultKey]).toString("base64");
const VALUE = Buffer.from(vaultSecret.data.data[vaultKey]).toString('base64');
const DOCKER_SECRET = {
name: secretName,
data: VALUE
data: VALUE,
};
return DOCKER.createSecret(DOCKER_SECRET);
}
Loading

0 comments on commit edfa5b4

Please sign in to comment.