Skip to content

Commit

Permalink
setup AWS secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
David405 committed Apr 26, 2024
1 parent f780c75 commit 3325aeb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const {
SecretsManagerClient,
GetSecretValueCommand,
} = require("@aws-sdk/client-secrets-manager");

async function test() {

const secret_name = "KEYSTORE";

const client = new SecretsManagerClient({
region: "us-east-1",
});

let response;

try {
response = await client.send(
new GetSecretValueCommand({
SecretId: secret_name,
VersionStage: "AWSCURRENT", // VersionStage defaults to AWSCURRENT if unspecified
})
);
} catch (error) {
// For a list of exceptions thrown, see
// https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html
throw error;
}

const secret = response.SecretString;

console.log(secret);
}
test();

0 comments on commit 3325aeb

Please sign in to comment.