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

arc-plugin-lambda-env

v1.1.1

Published

Arc serverless framework (arc.codes) plugin for adding env variables to your lambdas from architect created resources

Downloads

10

Readme

arc-plugin-lambda-env  

Arc serverless framework (arc.codes) plugin for adding env variables to your lambdas from architect created resources

This plugin will add environment variables with logical names of resources created by your .arc schema.

Initial support only for @tables (dynamodb table names)

Install

npm i --save-dev arc-plugin-lambda-env

Usage

After installing add @plugins and @lambda-env-vars pragmas to your app.arc file:

app.arc

@app
myapp

@http
get /

@tables
mytable
  pk *String
  sk **String
tabletwo
  pk *String
  sk **String

@lambda-env-vars
tables
  mytable MY_APP_TABLE_NAME
  tabletwo TABLE_TWO_NAME

@plugins
arc-plugin-lambda-env

Options

This plugin supports the following options under the @lambda-env-vars pragma:

|Option|Description|Example| |---|---|---| |tables| A list of tablename => ENV_VAR_NAME to be added to every lambda in your app|tables  tablename ENV_VAR_NAME|

Sandbox

Running arc sandbox will run your lambdas locally with the correct env variables defined. In order to In sandbox, you'll need to write code to determine what the local dynamodb endpoint is. See an example in the sample-app code. Arc 10 adds a ARC_SANDBOX ENV variable containing a JSON string that can be parsed to find the locally running port in ports.tables. In deployed environments ARC_SANDBOX will be undefined and your clients should automatically connect to the right endpoint/region based on aws lambda injected vars.

Sample Application

There is a sample application located under sample-app/. cd into that directory, npm install and you can run locally via npm start or npx arc sandbox or deploy to the internet via npx arc deploy.

⚠️ Known Issues

Supported architect versions

This plugin will work for architect version 10.0.0-RC.2 and above. Please use version 0.1.0 of this plugin if you have architect version 9.0.2 or below. Any versions in between are currently not supported

Only @tables (dynamodb) supported

I'll be adding support for injecting other resources identifiers as environment variables to your lambdas like @events (sns) and @queues (sqs).

Can't target specific lambdas

As of now, declared env variables go to all lambda functions. Would be nice to specify which lambdas get which env variables added.

Other Ideas

Config file vs ENV Vars

It might be nicer to write a config file, probably in the universal json, on build/deploy that can be imported in specified lambdas rather than using environment variables.