Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ryanburnette/serverless-config-environment-variables


https://github.com/ryanburnette/serverless-config-environment-variables

Last synced: 22 days ago
JSON representation

Awesome Lists containing this project

README

        

# serverless-config-environment-variables

Testing out configuring the environment on Serverless.

These two lines in `serverless.yml` do the job.

```yml
...
stage: ${opt:stage, 'dev'}
environment: ${file(./serverless.config.${self:provider.stage}.yml)}
```

This reads in `serverless.config.dev.yml`, replace `dev` with the desired
stage, and sets those environment variables accordingly.

Deploy this and see `process.env` in the response to the HTTP event.

The config files normally wouldn't be committed to Git.