npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dvsa/secrets-manager

v1.2.1

Published

A utility class for accessing secrets stored with AWS Secrets Manager. Provides overrides from ENV variables.

Downloads

227

Readme

Secrets Manager

A utility class for accessing secrets stored with AWS Secrets Manager.

Provides ability to override keys by implementing them as ENVIRONMENT variables.

Configuration

Accessing the AWS Secrets Manager requires these environment variables:

AWS_REGION

The AWS region, normally this is supplied by default within AWS resources.

This is used by the AWS Secrets Manager Client.

Example

eu-west-1

Using the utility class

The class SecretsManager provides two methods:

getSecret(secretName)

async getSecret(secretName: string): Promise<Record<string, string>> {}

This method will return a KEY, VALUE pairs as an object of all secrets stored in the AWS Secrets Manager store specified by secretName. This store contains KEY, VALUE pairs.

getSecretWithKey(secretName, key)

async getSecretWithKey(secretName: string, key: string): Promise<string> {}

This method will call the previous, and extract (if defined) the key-value from the secret store.

Overriding key values

Should you need to override the value from key you can specify the key as an environment variable. A call will not be made to AWS Secrets Manager. This makes it useful for local development environments.

Example
console.log(process.env.MY_KEY_NAME); //MySecret

const secret = getSecretWithKey('mySecretName', 'MY_KEY_NAME');

console.log(secret); // MySecret

Requirements

Build

  • npm i
  • npm run build:dev

Tests

  • The Jest framework is used to run tests and collect code coverage
  • To run the tests, run the following command within the root directory of the project: npm test
  • Coverage results will be displayed on terminal and stored in the coverage directory
    • The coverage requirements can be set in jest.config.js

Logging

This library uses https://github.com/debug-js/debug to provide an opt-in logging experience.

To enable logging from this package, set the DEBUG environment variable to @dvsa/secrets-manager. For example, to run your tests with the library in debug logging mode:

DEBUG=@dvsa/secrets-manager npm run test