Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secrets Manager middleware #151

Closed
dschep opened this issue Apr 6, 2018 · 6 comments
Closed

Secrets Manager middleware #151

dschep opened this issue Apr 6, 2018 · 6 comments

Comments

@dschep
Copy link

dschep commented Apr 6, 2018

In the same vein as the SSM middleware, a middleware for the newly anounced Secrets Manager would be really useful.

Here are the aws-sdk docs: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SecretsManager.html#getSecretValue-property

@hsz
Copy link
Contributor

hsz commented Apr 15, 2018

I have created AWS Secrets Manager as a middy-secrets package:

https://www.npmjs.com/package/middy-secrets
Repository: https://github.com/hsz/middy-secrets

Example usage:

import middy from 'middy';
import secrets from 'middy-secrets';

const fn = () => {
  console.log('process.env', process.env);
  // contains secrets from AWS Secrets Manager
};

const handler = middy(fn)
  .use(secrets({
    region: 'eu-west-1',
    secretName: 'dev/mySecrets',
  }));

module.exports = { handler };

Any comments/PRs are welcome!

@lmammino
Copy link
Member

Awesome job @hsz! I'd say we should probably add a section on the main README to list all the non-official middlewares

@hsz
Copy link
Contributor

hsz commented Apr 20, 2018

@lmammino that's great to hear.
I also have to thank for the middy! For a year I was using my custom, less complex wrapper, but middy fulfills my requirements and gives even more, good job! :)

@dankelleher
Copy link

Hi @hsz I added a PR to switch from ES6 exports to node module.exports so that it works out of the box with lambda + middy without having to use any transpilers:

hsz/middy-secrets#2

@hsz
Copy link
Contributor

hsz commented May 21, 2018

@dankelleher Thanks! I've merged it and published with v.0.2.1

@hsz
Copy link
Contributor

hsz commented Sep 19, 2018

@lmammino I think that this issue can be successfuly closed.
@dschep secretsMiddleware has been added to the middy

FYI - just marked my middy-secrets as deprecated.

@willfarrell willfarrell mentioned this issue Dec 31, 2020
63 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants