mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
docs(Variables): Cleanup example (#9023)
This commit is contained in:
parent
a44e138c52
commit
fdaba7117f
@ -63,15 +63,15 @@ For example:
|
||||
provider:
|
||||
name: aws
|
||||
environment:
|
||||
MY_SECRET: ${file(./config.${opt:stage, self:provider.stage, 'dev'}.json):CREDS}
|
||||
MY_SECRET: ${file(./config.${opt:stage, 'dev'}.json):CREDS}
|
||||
```
|
||||
|
||||
If `sls deploy --stage qa` is run, the option `stage=qa` is used inside the `${file(./config.${opt:stage, self:provider.stage, 'dev'}.json):CREDS}` variable and it will resolve the `config.qa.json` file and use the `CREDS` key defined.
|
||||
If `sls deploy --stage qa` is run, the option `stage=qa` is used inside the `${file(./config.${opt:stage, 'dev'}.json):CREDS}` variable and it will resolve the `config.qa.json` file and use the `CREDS` key defined.
|
||||
|
||||
**How that works:**
|
||||
|
||||
1. stage is set to `qa` from the option supplied to the `sls deploy --stage qa` command
|
||||
2. `${opt:stage, self:provider.stage, 'dev'}` resolves to `qa` and is used in `${file(./config.${opt:stage, self:provider.stage, 'dev'}.json):CREDS}`
|
||||
2. `${opt:stage, 'dev'}` resolves to `qa` and is used in `${file(./config.${opt:stage, 'dev'}.json):CREDS}`
|
||||
3. `${file(./config.qa.json):CREDS}` is found & the `CREDS` value is read
|
||||
4. `MY_SECRET` value is set
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user