https://github.com/agutoli/serverless-ini-env
Nice serverless plugin to setup environment variables with ini file
https://github.com/agutoli/serverless-ini-env
aws aws-lambda ini javascript js serverless serverless-plugin
Last synced: 9 months ago
JSON representation
Nice serverless plugin to setup environment variables with ini file
- Host: GitHub
- URL: https://github.com/agutoli/serverless-ini-env
- Owner: agutoli
- Created: 2019-01-28T07:26:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T17:34:48.000Z (over 4 years ago)
- Last Synced: 2024-04-24T15:27:09.023Z (almost 2 years ago)
- Topics: aws, aws-lambda, ini, javascript, js, serverless, serverless-plugin
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# serverless-ini-env
[](http://www.serverless.com)
[](https://github.com/agutoli/serverless-ini-env/issues) [](https://www.npmjs.com/package/serverless-ini-env)
[](https://www.npmjs.com/package/serverless-ini-env)
[](#contributing)
## Install
`npm install -D serverless-ini-env`
or
`serverless plugin install --name serverless-ini-env`
Add the plugin to your `serverless.yml` file:
```yaml
plugins:
- serverless-ini-env
```
## Serverless configuration
```yaml
custom:
serverless-ini-env:
dev: "./your_configs/dev.ini"
prod: "./your_configs/prod.ini"
functions:
my_function_name_a:
handler: handler.a_func
my_function_name_b:
handler: handler.b_func
```
`Note:` If you did not specify any configuration, plugins will consider root folder and stage options ex.
`sls deploy --stage qa` -> `./qa.ini`
`sls deploy --stage dev` -> `./dev.ini`
## Environment configuration example
`./your_configs/dev.ini`
```ini
# will be available for both functions
MY_GLOBAL_VAR=DEV_VALUE
[my_function_name_a]
NAME="function A"
FOO=DEV_VALUE
[my_function_name_b]
NAME="function B"
BAR=DEV_VALUE
[my_function_name_a,my_function_name_b]
SHARED_VARS="function A and B"
```
`./your_configs/prod.ini`
```ini
# will be available for both functions
MY_GLOBAL_VAR=PROD_VALUE
[my_function_name_a]
NAME="function A"
FOO=PROD_VALUE
[my_function_name_b]
NAME="function B"
BAR=PROD_VALUE
[my_function_name_a,my_function_name_b]
SHARED_VARS="function A and B"
```
# Usage and command line options
```shell
# Update all lambda environments
sls update-environments --stage prod
# Update a single function environments vars
sls update-environments function -f my_function_name_a --stage qa
```
## Contributing
Yes, thank you!
This plugin is community-driven, most of its features are from different authors.
Please update the docs and tests and add your name to the package.json file.
We try to follow [Airbnb's JavaScript Style Guide](https://github.com/airbnb/javascript).
## License
MIT