docs(Variables): Cleanup example (#9023)

This commit is contained in:
Christian Takle 2021-02-26 14:47:26 +00:00 committed by GitHub
parent a44e138c52
commit fdaba7117f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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