@vitta-health/awsenv

Secure way to handle environment variables in Docker with AWS Parameter Store

Usage no npm install needed!

<script type="module">
  import vittaHealthAwsenv from 'https://cdn.skypack.dev/@vitta-health/awsenv';
</script>

README

AWSENV

A secure way to handle environment variables in Docker with AWS Parameter Store.

Install

$ npm i -g awsenv

Usage ways

Simple

First suggestion:

$ awsenv -r sa-east-1 \
  -n /staging/my-app

# this will result as:
export NODE_ENV=staging
export DB_USERNAME=root
export DB_PASSWORD=mysecretpassword

# so, you may use as:
$ $(awsenv -r sa-east-1 -n /staging/my-app)

Second suggestion:

With a combination of dotenv, this is another solution at build stage:

$ awsenv --without-export \
  -r sa-east-1 \
  -n /staging/my-app

# this will result as:
NODE_ENV=staging
DB_USERNAME=root
DB_PASSWORD=mysecretpassword

# so, you may use as:
$ awsenv --without-export \
  -r sa-east-1 \
  -n /staging/my-app > /app/myapp/.env
$ cat /dre/mysapp/.env
NODE_ENV=staging
DB_USERNAME=root
DB_PASSWORD=mysecretpassword

Using Environment Variables

# first you set your variables
export AWS_REGION=sa-east-1
export AWSENV_NAMESPACE=/staging/my-app

# exec it
$ awsenv

# this will result as:
export NODE_ENV=staging
export DB_USERNAME=root
export DB_PASSWORD=mysecretpassword

# or
$ awsenv --without-export > /app/myapp/.env
$ cat /app/mysapp/.env
NODE_ENV=staging
DB_USERNAME=root
DB_PASSWORD=mysecretpassword

Contribuiting

Fork-it first, and:

$ npm link
$ awsenv version
1.0.1

Make your magic!