Skip to content

Secure way to handle environment variables in Docker with AWS Parameter Store based in Node.js

Notifications You must be signed in to change notification settings

vitta-health/awsenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Secure way to handle environment variables in Docker with AWS Parameter Store based in Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published