1.0.2 • Published 4 years ago
aws-parameter-dotenv v1.0.2
aws-parameter-dotenv
Tiny Library/wrapper around AWS System Parameter Store to load environment variables directly from AWS.
Use
yarn add aws-parameter-dotenv or npm i aws-parameter-dotenv.
This library is very opinated on how to name/structure the parameter names following this
structure: {projectName}/{environmentName}/{parameterName}. The parameterName should be camelCase.
- You can use the library to add parameters as follow:
import awsparamterdotenv from "aws-parameter-dot-env";
/**
* Add environment variables
* */
await awsparamterdotenv({
project: "projectName",
environment: "environment",
region: "us-east-1",
}).addParameter({
name: "myParameter",
value: "myValue",
secret: true, // should be stored as secure string
});- Or just load the parameters
import awsparamterdotenv from "aws-parameter-dot-env";
/**
* Load all the environment variables
* */
await awsparamterdotenv({
project: "projectName",
environment: "environment",
region: "us-east-1",
}).load();
process.env.myParameter === "myValue"; // is TRUETesting
index.unit.spec.tscontains the unit testsindex.integration.spec.tscontains the integration tests: It's required valid AWS Credentials accounts with IAM permission to execute operations on SMS. To run the integration tests rename the.env.exampleto.envand add your AWS Credentials.