Reputation: 1865
I'm using Serverless for deploying my functions to AWS Lambda and Serverless Dot-Env to load in environment variables. However it seems there is no way to exclude some of these variables from the deployed Lambda. If you go on the Lambda dashboard on AWS you will find all variables listed on Environment variables
, but what if I don't want some of them (like the NODE_ENV
variable) to be there? I tried doing this in my serverless.yml file
exclude:
- ${env:NODE_ENV}
But the variable was still there as you can see in the image below
So is there a way to hide such variables?
Upvotes: 1
Views: 1944
Reputation: 16087
serverless-dot-env
currently does not have a blacklist option but they do have a whitelist option.
Example from https://github.com/colynb/serverless-dotenv-plugin#plugin-options:
custom:
dotenv:
path: path/to/my/.env (default ./.env)
basePath: path/to/ (default ./)
include:
- AUTH0_CLIENT_ID
- AUTH0_CLIENT_SECRET
If you use include
, only the variables you specified will be included.
Example from https://github.com/colynb/serverless-dotenv-plugin#plugin-options:
custom:
dotenv:
exclude:
- NODE_ENV # E.g for Google Cloud Functions, you cannot pass this env variable.
Upvotes: 1