# General Translation Platform: 添加环境变量
URL: https://generaltranslation.com/zh/docs/platform/locadex/guides/adding-environment-variables.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: 如何添加键值对形式的环境变量，以便 Locadex 在自动化运行时将其注入沙箱。

环境变量可用于 API 密钥、token、构建配置，或在 Locadex 处理文件前后运行的命令。

Locadex 运行自动化时，会将环境变量注入沙箱。

## 添加变量 [#add-variable]

你需要拥有 **Manage Locadex secrets** 权限。默认的 Admin 和 Developer 角色都拥有此权限。

打开 Organization 的 Locadex Secrets 页面 `/org/{orgId}/locadex/secrets`，将 `{orgId}` 替换为你的 Organization ID。此页面当前未在仪表板侧边栏中列出。点击 **Add Variable**。

输入：

* **键**：环境变量名称。
* **值**：密钥或配置值。

然后点击 **Save**。

## 编辑变量 [#edit-variable]

更新键或值，然后点击**保存**。编辑时，可使用可见性控件显示或隐藏该值。

## 删除变量 [#delete-variable]

点击变量旁边的删除图标，然后保存更改。

## 常见用途 [#common-uses]

环境变量可用于：

* 构建工具或文档工具使用的 API 密钥。
* GitHub 或包注册表 token。
* 构建期间所需的功能标记。
* 预处理或后处理命令的配置。

自动化运行时，环境变量会被注入到 [Locadex Runtime](/docs/platform/locadex/reference/vm-image) 中。它们在静态存储时会被加密，并且只有 Locadex Runtime 可以访问。

## Next steps

- /docs/platform/locadex/guides/using-in-monorepos
- /docs/platform/locadex/guides/configuring-automations
- /docs/platform/locadex/guides/auto-merging-prs
- /docs/platform/locadex/guides/managing-languages

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
