@connected-home/serverless-plugin-stringify-variables

1.0.1 • Public • Published

serverless-plugin-stringify-variables

Serverless plugin that stringifies nested environment variables.

Why use it?

Serverless by default doesn't allow environment variables to be nested objects. If you want to group your variables, or have more complex data srtructures for various stages, this helps to organise them in a meaningful way.

How it works

You can use objects as environment variables:

{
  "COMPLEX_VARIABLE": {
    "url": "url",
    "database_name": "name"
  },
  "STRAIGHTFORWARD_VARIABLE": "just a normal value"
}

They will get stringified before deployment, and you can then require them in your code:

const COMPLEX_VARIABLE = json.parse(process.env.COMPLEX_VARIABLE);
const STRAIGHTFORWARD_VARIABLE = process.env.STRAIGHTFORWARD_VARIABLE;

Package Sidebar

Install

npm i @connected-home/serverless-plugin-stringify-variables

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • bvic23
  • domthom
  • sandfox