i18n - docs translations (#17434)

Created by Github action

Co-authored-by: github-actions <github-actions@twenty.com>
This commit is contained in:
github-actions[bot]
2026-01-26 09:06:17 +01:00
committed by GitHub
parent 2353bc62cc
commit e0d4492013
651 changed files with 37463 additions and 32557 deletions
@@ -1,146 +1,146 @@
---
title: Setup
title: 设置
---
# Configuration Management
# 配置管理
<Warning>
**First time installing?** Follow the [Docker Compose installation guide](/l/zh/developers/self-host/capabilities/docker-compose) to get Twenty running, then return here for configuration.
**第一次安装?** 请按照 [Docker Compose 安装指南](/l/zh/developers/self-host/capabilities/docker-compose) 获得 Twenty 运行,然后返回此处进行配置。
</Warning>
Twenty offers **two configuration modes** to suit different deployment needs:
Twenty 提供**两种配置模式**以适应不同的部署需求:
**Admin panel access:** Only users with admin privileges (`canAccessFullAdminPanel: true`) can access the configuration interface.
**管理员面板访问:** 只有具有管理员权限的用户(`canAccessFullAdminPanel: true`) 可以访问配置界面。
## 1. Admin Panel Configuration (Default)
## 1. 管理员面板配置(默认)
```bash
IS_CONFIG_VARIABLES_IN_DB_ENABLED=true # default
```
**Most configuration happens through the UI** after installation:
**大多数配置在安装后通过 UI 进行:**
1. Access your Twenty instance (usually `http://localhost:3000`)
2. Go to **Settings / Admin Panel / Configuration Variables**
3. Configure integrations, email, storage, and more
4. Changes take effect immediately (within 15 seconds for multi-container deployments)
1. 访问你的 Twenty 实例(通常为 `http://localhost:3000`)
2. 转到 **设置 / 管理员面板 / 配置变量**
3. 配置集成、电子邮件、存储等
4. 更改会立即生效(多容器部署在 15 秒内)
<Warning>
**Multi-Container Deployments:** When using database configuration (`IS_CONFIG_VARIABLES_IN_DB_ENABLED=true`), both server and worker containers read from the same database. Admin panel changes affect both automatically, eliminating the need to duplicate environment variables between containers (except for infrastructure variables).
**多容器部署:** 当使用数据库配置(`IS_CONFIG_VARIABLES_IN_DB_ENABLED=true`)时,server worker 容器都会从同一个数据库读取。 管理员面板更改会自动影响两者,无需在容器之间重复环境变量(基础设施变量除外)。
</Warning>
**What you can configure through the admin panel:**
**通过管理员面板可以配置的内容:**
* **Authentication** - Google/Microsoft OAuth, password settings
* **Email** - SMTP settings, templates, verification
* **Storage** - S3 configuration, local storage paths
* **Integrations** - Gmail, Google Calendar, Microsoft services
* **Workflow & Rate Limiting** - Execution limits, API throttling
* **And much more...**
* **身份验证** - Google/Microsoft OAuth、密码设置
* **电子邮件** - SMTP 设置、模板、验证
* **存储** - S3 配置、本地存储路径
* **集成** - Gmail, Google Calendar, Microsoft 服务
* **工作流和速率限制** - 执行限制、API 限流
* **还有更多……**
![Admin Panel Configuration Variables](/images/user-guide/setup/admin-panel-config-variables.png)
![管理员面板配置变量](/images/user-guide/setup/admin-panel-config-variables.png)
<Warning>
Each variable is documented with descriptions in your admin panel at **Settings → Admin Panel → Configuration Variables**.
Some infrastructure settings like database connections (`PG_DATABASE_URL`), server URLs (`SERVER_URL`), and app secrets (`APP_SECRET`) can only be configured via `.env` file.
每个变量都在您的管理面板的**设置 → 管理员面板 → 配置变量**中记录了说明。
某些基础设施设置如数据库连接 (`PG_DATABASE_URL`)、服务器 URL (`SERVER_URL`) 和应用程序密钥 (`APP_SECRET`) 只能通过 `.env` 文件配置。
[Complete technical reference →](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts)
[完整技术参考→](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts)
</Warning>
## 2. Environment-Only Configuration
## 2. 仅限环境配置
```bash
IS_CONFIG_VARIABLES_IN_DB_ENABLED=false
```
**All configuration managed through `.env` files:**
**所有配置通过 `.env` 文件管理:**
1. Set `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false` in your `.env` file
2. Add all configuration variables to your `.env` file
3. Restart containers for changes to take effect
4. Admin panel will show current values but cannot modify them
1. 在 `.env` 文件中设置 `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false`
2. 将所有配置变量添加到 `.env` 文件中
3. 重启容器以使更改生效
4. 管理员面板将显示当前值,但无法修改它们
## Multi-Workspace Mode
## 多工作区模式
By default, Twenty runs in **single-workspace mode** — ideal for most self-hosted deployments where you need one CRM instance for your organization.
默认情况下,Twenty 以**单工作区模式**运行——对于大多数需要为组织部署一个 CRM 实例的自托管部署而言,这是理想之选。
### Single-Workspace Mode (Default)
### 单工作区模式(默认)
```bash
IS_MULTIWORKSPACE_ENABLED=false # default
```
* One workspace per Twenty instance
* First user automatically becomes admin with full privileges (`canImpersonate` and `canAccessFullAdminPanel`)
* New signups are disabled after the first workspace is created
* Simple URL structure: `https://your-domain.com`
* 每个 Twenty 实例一个工作区
* 首位用户会自动成为具有完整权限的管理员(`canImpersonate` `canAccessFullAdminPanel`
* 创建第一个工作区后,新注册将被禁用
* 简单的 URL 结构:`https://your-domain.com`
### Enabling Multi-Workspace Mode
### 启用多工作区模式
```bash
IS_MULTIWORKSPACE_ENABLED=true
DEFAULT_SUBDOMAIN=app # default value
```
Enable multi-workspace mode for SaaS-like deployments where multiple independent teams need their own workspaces on the same Twenty instance.
对于在同一 Twenty 实例上需要多个独立团队拥有各自工作区的类 SaaS 部署,启用多工作区模式。
**Key differences from single-workspace mode:**
**与单工作区模式的关键区别:**
* Multiple workspaces can be created on the same instance
* Each workspace gets its own subdomain (e.g., `sales.your-domain.com`, `marketing.your-domain.com`)
* Users sign up and log in at `{DEFAULT_SUBDOMAIN}.your-domain.com` (e.g., `app.your-domain.com`)
* No automatic admin privileges — first user in each workspace is a regular user
* Workspace-specific settings like subdomain and custom domain become available in workspace settings
* 同一实例上可以创建多个工作区
* 每个工作区都有其自己的子域(例如,`sales.your-domain.com``marketing.your-domain.com`
* 用户在 `{DEFAULT_SUBDOMAIN}.your-domain.com` 进行注册和登录(例如,`app.your-domain.com`
* 不自动授予管理员权限——每个工作区的首位用户是普通用户
* 子域、自定义域名等与工作区相关的设置将在工作区设置中可用。
<Warning>
**Environment-only setting:** `IS_MULTIWORKSPACE_ENABLED` can only be configured via `.env` file and requires a restart. It cannot be changed through the admin panel.
**仅限环境的设置:**`IS_MULTIWORKSPACE_ENABLED` 只能通过 `.env` 文件进行配置,并且需要重启。 无法通过管理面板进行更改。
</Warning>
### DNS Configuration for Multi-Workspace
### 多工作区模式的 DNS 配置
When using multi-workspace mode, configure your DNS with a wildcard record to allow dynamic subdomain creation:
使用多工作区模式时,请在 DNS 中配置通配符记录,以允许动态创建子域:
```
*.your-domain.com -> your-server-ip
```
This enables automatic subdomain routing for new workspaces without manual DNS configuration.
这使新工作区能够在无需手动配置 DNS 的情况下自动进行子域路由。
### Restricting Workspace Creation
### 限制工作区创建
In multi-workspace mode, you may want to limit who can create new workspaces:
在多工作区模式下,你可能希望限制谁可以创建新工作区:
```bash
IS_WORKSPACE_CREATION_LIMITED_TO_SERVER_ADMINS=true
```
When enabled, only users with `canAccessFullAdminPanel` can create additional workspaces. Users can still create their first workspace during initial signup.
启用后,只有具有 `canAccessFullAdminPanel` 权限的用户才能创建其他工作区。 用户仍可在首次注册时创建他们的第一个工作区。
## Gmail & Google Calendar Integration
## Gmail & Google Calendar 集成
### Create Google Cloud Project
### 创建 Google 云项目
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a new project or select existing one
3. Enable these APIs:
1. 转到 [Google 云控制台](https://console.cloud.google.com/)
2. 创建新项目或选择现有项目
3. 启用这些 API
* [Gmail API](https://console.cloud.google.com/apis/library/gmail.googleapis.com)
* [Google Calendar API](https://console.cloud.google.com/apis/library/calendar-json.googleapis.com)
* [People API](https://console.cloud.google.com/apis/library/people.googleapis.com)
### Configure OAuth
### 配置 OAuth
1. Go to [Credentials](https://console.cloud.google.com/apis/credentials)
2. Create OAuth 2.0 Client ID
3. Add these redirect URIs:
* `https://{your-domain}/auth/google/redirect` (for SSO)
* `https://{your-domain}/auth/google-apis/get-access-token` (for integrations)
1. 转到 [凭据](https://console.cloud.google.com/apis/credentials)
2. 创建 OAuth 2.0 客户端 ID
3. 添加这些重定向 URI
* `https://{your-domain}/auth/google/redirect` (用于 SSO)
* `https://{your-domain}/auth/google-apis/get-access-token` (用于集成)
### Configure in Twenty
### Twenty 中配置
1. Go to **Settings → Admin Panel → Configuration Variables**
2. Find the **Google Auth** section
3. Set these variables:
1. 转到 **设置 → 管理员面板 → 配置变量**
2. 找到 **Google 身份验证** 部分
3. 设置这些变量:
* `MESSAGING_PROVIDER_GMAIL_ENABLED=true`
* `CALENDAR_PROVIDER_GOOGLE_ENABLED=true`
* `AUTH_GOOGLE_CLIENT_ID={client-id}`
@@ -149,35 +149,35 @@ When enabled, only users with `canAccessFullAdminPanel` can create additional wo
* `AUTH_GOOGLE_APIS_CALLBACK_URL=https://{your-domain}/auth/google-apis/get-access-token`
<Warning>
**Environment-only mode:** If you set `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false`, add these variables to your `.env` file instead.
**仅限环境模式:** 如果你设置 `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false`,请将这些变量添加到 `.env` 文件中。
</Warning>
**Required scopes** (automatically configured):
[See relevant source code](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/src/engine/core-modules/auth/utils/get-google-apis-oauth-scopes.ts#L4-L10)
**所需范围**(自动配置):
[查看相关源码](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/src/engine/core-modules/auth/utils/get-google-apis-oauth-scopes.ts#L4-L10)
* `https://www.googleapis.com/auth/calendar.events`
* `https://www.googleapis.com/auth/gmail.readonly`
* `https://www.googleapis.com/auth/profile.emails.read`
### If your app is in test mode
### 如果你的应用程序处于测试模式
If your app is in test mode, you will need to add test users to your project.
如果你的应用程序处于测试模式,你需要将测试用户添加到你的项目中。
Under [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent), add your test users to the "Test users" section.
[OAuth 同意屏幕](https://console.cloud.google.com/apis/credentials/consent) 下,将你的测试用户添加到 "测试用户" 部分。
## Microsoft 365 Integration
## Microsoft 365 集成
<Warning>
Users must have a [Microsoft 365 Licence](https://admin.microsoft.com/Adminportal/Home) to be able to use the Calendar and Messaging API. They will not be able to sync their account on Twenty without one.
用户必须拥有 [Microsoft 365 许可证](https://admin.microsoft.com/Adminportal/Home) 才能使用日历和消息传递 API。 没有许可证,他们将无法在 Twenty 上同步他们的帐户。
</Warning>
### Create a project in Microsoft Azure
### Microsoft Azure 中创建项目
You will need to create a project in [Microsoft Azure](https://portal.azure.com/#view/Microsoft_AAD_IAM/AppGalleryBladeV2) and get the credentials.
你需要在 [Microsoft Azure](https://portal.azure.com/#view/Microsoft_AAD_IAM/AppGalleryBladeV2) 中创建项目并获取凭据。
### Enable APIs
### 启用 API
On Microsoft Azure Console enable the following APIs in "Permissions":
Microsoft Azure 控制台中的“权限”中启用以下 API
* Microsoft Graph: Mail.ReadWrite
* Microsoft Graph: Mail.Send
@@ -188,20 +188,20 @@ On Microsoft Azure Console enable the following APIs in "Permissions":
* Microsoft Graph: profile
* Microsoft Graph: offline_access
Note: "Mail.ReadWrite" and "Mail.Send" are only mandatory if you want to send emails using our workflow actions. You can use "Mail.Read" instead if you only want to receive emails.
注意:“Mail.ReadWrite”和“Mail.Send”仅在你想使用我们的工作流程操作发送电子邮件时是强制性的。 如果你只想接收邮件,你可以使用“Mail.Read”。
### Authorized redirect URIs
### 授权重定向 URI
You need to add the following redirect URIs to your project:
你需要将以下重定向 URI 添加到你的项目中:
* `https://{your-domain}/auth/microsoft/redirect` if you want to use Microsoft SSO
* `https://{your-domain}/auth/microsoft/redirect` 如果你想使用 Microsoft SSO
* `https://{your-domain}/auth/microsoft-apis/get-access-token`
### Configure in Twenty
### Twenty 中配置
1. Go to **Settings → Admin Panel → Configuration Variables**
2. Find the **Microsoft Auth** section
3. Set these variables:
1. 转到 **设置 → 管理员面板 → 配置变量**
2. 找到 **Microsoft 身份验证** 部分
3. 设置这些变量:
* `MESSAGING_PROVIDER_MICROSOFT_ENABLED=true`
* `CALENDAR_PROVIDER_MICROSOFT_ENABLED=true`
* `AUTH_MICROSOFT_ENABLED=true`
@@ -211,32 +211,32 @@ You need to add the following redirect URIs to your project:
* `AUTH_MICROSOFT_APIS_CALLBACK_URL=https://{your-domain}/auth/microsoft-apis/get-access-token`
<Warning>
**Environment-only mode:** If you set `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false`, add these variables to your `.env` file instead.
**仅限环境模式:** 如果你设置 `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false`,请将这些变量添加到 `.env` 文件中。
</Warning>
### Configure scopes
### 配置范围
[See relevant source code](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/src/engine/core-modules/auth/utils/get-microsoft-apis-oauth-scopes.ts#L2-L9)
[查看相关源码](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/src/engine/core-modules/auth/utils/get-microsoft-apis-oauth-scopes.ts#L2-L9)
* 'openid'
* 'email'
* 'profile'
* '电子邮件'
* '个人资料'
* 'offline_access'
* 'Mail.ReadWrite'
* 'Mail.Send'
* 'Calendars.Read'
### If your app is in test mode
### 如果你的应用程序处于测试模式
If your app is in test mode, you will need to add test users to your project.
如果你的应用程序处于测试模式,你需要将测试用户添加到你的项目中。
Add your test users to the "Users and groups" section.
将你的测试用户添加到“用户和组”部分。
## Background Jobs for Calendar & Messaging
## 日历和消息传递的后台作业
After configuring Gmail, Google Calendar, or Microsoft 365 integrations, you need to start the background jobs that sync data.
在配置完 GmailGoogle Calendar Microsoft 365 集成后,你需要启动同步数据的后台作业。
Register the following recurring jobs in your worker container:
在你的工作容器中注册以下重复作业:
```bash
# from your worker container
@@ -249,15 +249,15 @@ yarn command:prod cron:calendar:ongoing-stale
yarn command:prod cron:workflow:automated-cron-trigger
```
## Email Configuration
## 电子邮件配置
1. Go to **Settings → Admin Panel → Configuration Variables**
2. Find the **Email** section
3. Configure your SMTP settings:
1. 转到 **设置 → 管理员面板 → 配置变量**
2. 找到 **电子邮件** 部分
3. 配置你的 SMTP 设置:
<ArticleTabs label1="Gmail" label2="Office365" label3="Smtp4dev">
<ArticleTab>
You will need to provision an [App Password](https://support.google.com/accounts/answer/185833).
你需要提供一个 [应用密码](https://support.google.com/accounts/answer/185833)
* EMAIL_DRIVER=smtp
* EMAIL_SMTP_HOST=smtp.gmail.com
@@ -267,7 +267,7 @@ yarn command:prod cron:workflow:automated-cron-trigger
</ArticleTab>
<ArticleTab>
Keep in mind that if you have 2FA enabled, you will need to provision an [App Password](https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9).
请记住,如果您启用了双重身份验证,您需要提供一个 [应用密码](https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9)
* EMAIL_DRIVER=smtp
* EMAIL_SMTP_HOST=smtp.office365.com
@@ -277,11 +277,11 @@ yarn command:prod cron:workflow:automated-cron-trigger
</ArticleTab>
<ArticleTab>
**smtp4dev** is a fake SMTP email server for development and testing.
**smtp4dev** 是一个用于开发和测试的假 SMTP 电子邮件服务器。
* Run the smtp4dev image: `docker run --rm -it -p 8090:80 -p 2525:25 rnwood/smtp4dev`
* Access the smtp4dev ui here: [http://localhost:8090](http://localhost:8090)
* Set the following variables:
* 运行 smtp4dev 镜像: `docker run --rm -it -p 8090:80 -p 2525:25 rnwood/smtp4dev`
* 在此处访问 smtp4dev UI[http://localhost:8090](http://localhost:8090)
* 设置以下变量:
* EMAIL_DRIVER=smtp
* EMAIL_SMTP_HOST=localhost
* EMAIL_SMTP_PORT=2525
@@ -289,5 +289,49 @@ yarn command:prod cron:workflow:automated-cron-trigger
</ArticleTabs>
<Warning>
**Environment-only mode:** If you set `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false`, add these variables to your `.env` file instead.
**仅限环境模式:** 如果你设置 `IS_CONFIG_VARIABLES_IN_DB_ENABLED=false`,请将这些变量添加到 `.env` 文件中。
</Warning>
## 无服务器函数
Twenty 支持用于工作流和自定义逻辑的无服务器函数。 执行环境通过 `SERVERLESS_TYPE` 环境变量进行配置。
<Warning>
\*\*安全提示:\*\*本地无服务器驱动(`SERVERLESS_TYPE=LOCAL`)在没有沙箱的情况下,在主机上的 Node.js 进程中直接运行代码。 它应仅在开发环境中用于可信代码。 对于在生产环境中处理不受信任代码的部署,我们强烈建议使用 `SERVERLESS_TYPE=LAMBDA` 或 `SERVERLESS_TYPE=DISABLED`。
</Warning>
### 可用驱动
| 驱动 | 环境变量 | 用例 | 安全级别 |
| ------ | -------------------------- | -------------- | -------- |
| 禁用 | `SERVERLESS_TYPE=DISABLED` | 完全禁用无服务器函数 | 不适用 |
| 本地 | `SERVERLESS_TYPE=LOCAL` | 开发和可信环境 | 低(无沙箱) |
| Lambda | `SERVERLESS_TYPE=LAMBDA` | 生产环境(处理不受信任代码) | 高(硬件级隔离) |
### 推荐配置
**用于开发:**
```bash
SERVERLESS_TYPE=LOCAL # default
```
**用于生产(AWS):**
```bash
SERVERLESS_TYPE=LAMBDA
SERVERLESS_LAMBDA_REGION=us-east-1
SERVERLESS_LAMBDA_ROLE=arn:aws:iam::123456789:role/your-lambda-role
SERVERLESS_LAMBDA_ACCESS_KEY_ID=your-access-key
SERVERLESS_LAMBDA_SECRET_ACCESS_KEY=your-secret-key
```
**要禁用无服务器函数:**
```bash
SERVERLESS_TYPE=DISABLED
```
<Note>
使用 `SERVERLESS_TYPE=DISABLED` 时,任何尝试执行无服务器函数的操作都会返回错误。 如果你想在不启用无服务器函数能力的情况下运行 Twenty,这将很有用。
</Note>