2.0.5 • Published 4 years ago
@gravitywelluk/environment v2.0.5
Usage
Use at a convenient entry point to check that your environment is setup correctly (Webpack config, Serverless Stack deployment etc.)
import { validateAppEnvironment } from "@gravitywelluk/environment";
await validateAppEnvironment(process.env.ENVIRONMENT, {
  variables: [
    // sequelize (local dev)
    "DB_DATABASE",
    "DB_HOST",
    "DB_PORT",
    "DB_ENGINE",
    "DB_USERNAME",
    "DB_PASSWORD",
    // aws
    "REGION",
    // external apis
    "SOME_API_KEY"
  ],
  // put AWS Secret ARNs here for backend projects
  awsSecrets: [
    "DB_SECRET_ARN"
  ]
});This validation function will throw an error if required variables are not found. Secrets will also be checked to see if they exist in AWS Secrets Manager.