Skip to content

Commit

Permalink
commit by Serverless devs docs 11-30-2023 10:5:20
Browse files Browse the repository at this point in the history
  • Loading branch information
serverless-devs committed Nov 30, 2023
1 parent 8aff8b5 commit 03a208e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion content/zh/fc3/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ resources:
- 本地测试可以通过类似[dotenv](https://www.npmjs.com/package/dotenv)库来读取`.env`环境变量
- 在 FC 环境线上执行时候,会将环境变量直接注入到当前进程,NodeJS 应用可以通过`process.env.AccessKeyID`直接获取环境变量。

## Yaml是否支持全局变量/环境变量/引用外部文件
## Yaml 是否支持全局变量/环境变量/引用外部文件

Serverless Devs 的 Yaml 规范本身支持全局变量、环境变量以及外部内容的引入:

Expand Down
3 changes: 1 addition & 2 deletions content/zh/serverless-devs/awesome.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ category: '概述'

## 组件集合

- [阿里云函数计算(FC)](https://github.com/devsapp/fc)
- [阿里云Serverless应用引擎(FC)](https://github.com/devsapp/sae)
- [阿里云函数计算(FC)](https://github.com/devsapp/fc3)
- [AWS Lambda](https://github.com/devscomp/lambda)
- [百度智能云函数计算(CFC)](https://github.com/xinwuyun/cfc)
- [华为云函数工作流(FG)](https://github.com/zy-linn/fgs-component)
Expand Down
20 changes: 20 additions & 0 deletions content/zh/serverless-devs/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,27 @@ resources:

### 使用`${config('')}`获取当前配置的config变量

以下面的Yaml为例:

```yaml
props: # 组件的属性值
region: cn-hangzhou
function:
...
environmentVariables:
AccountID: ${config('AccountID')}
...
```

在`props`中,`${config('AccountID')}`将尝试获取在`s config`中配置的`AccountID`的值。若`AccountID`的值为`123456789012`,则渲染结果为:

```yaml
props: # 组件的属性值
region: cn-hangzhou
function:
...
environmentVariables:
AccountID: 123456789012
### 使用`${this.xx}`获取当前模块的信息

Expand Down

0 comments on commit 03a208e

Please sign in to comment.