Skip to main content

数据管理

¥Data Management

数据管理功能可用于导入、导出或传输数据。数据管理仅基于 CLI,但部分配置在管理面板中。

¥The Data Management feature can be used to import, export, or transfer data. Data Management is CLI-based only, but is partly configured in the admin panel.

功能的身份证

计划:免费功能。
角色和权限:角色 > 设置中的最低 "访问传输令牌设置页面" 权限 - 传输令牌。
激活:如果定义了传输盐,则可用并激活。
环境:在开发和生产环境中均可用。

¥ Plan: Free feature.
Role & permission: Minimum "Access the transfer tokens settings page" permission in Roles > Settings - Transfer tokens.
Activation: Available and activated if a transfer salt is defined.
Environment: Available in both Development & Production environment.

配置

¥Configuration

数据管理功能的一些配置选项在管理面板中可用,一些通过你的 Strapi 项目的代码处理。

¥Some configuration options for the Data Management feature are available in the admin panel, and some are handled via your Strapi project's code.

管理面板设置

¥Admin panel settings

Prerequisites

transfer.token.salt 应在 config/admin 配置文件中定义(参见 基于代码的配置)。

¥A transfer.token.salt should be defined in the config/admin configuration file (see code-based configuration).

配置功能的路径: 设置 > 全局设置 > 转移令牌

¥Path to configure the feature: Settings > Global settings > Transfer Tokens

传输令牌允许用户授权 strapi transfer CLI 命令(参见 数据传输 文档)。

¥Transfer tokens allow users to authorize the strapi transfer CLI command (see Data transfer documentation).

Transfer tokensTransfer tokens

Transfer Tokens 界面显示一个表格,列出了所有创建的 Transfer token。更具体地说,它显示每个转移令牌的名称、描述、创建日期和上次使用日期。

¥The Transfer Tokens interface displays a table listing all of the created Transfer tokens. More specifically, it displays each Transfer token's name, description, date of creation, and date of last use.

从那里,管理员还可以:

¥From there, administrators can also:

  • 单击 可编辑传输令牌的名称、描述、类型或 重新生成令牌

    ¥Click on the to edit a transfer token's name, description, or type, or regenerate the token.

  • 单击 以删除转移令牌。

    ¥Click on the to delete a Transfer token.

创建新的转移令牌

¥Creating a new transfer token

  1. 单击创建新的转移令牌按钮。

    ¥Click on the Create new Transfer Token button.

  2. 在 Transfer token 版本界面中,配置新的 Transfer token:

    ¥In the Transfer token edition interface, configure the new Transfer token:

    设置名称指示
    名称写下转移令牌的名称。
    描述(可选)编写转移令牌的描述。
    令牌持续时间选择令牌持续时间:7 天、30 天、90 天或无限制。
    令牌类型选择令牌类型:
    • 推送仅允许从本地实例传输到远程实例,
    • 拉动仅允许从远程实例传输到本地实例,
    • 或完全访问权限 允许两种类型的传输。
  3. 单击“保存”按钮。新的传输令牌将显示在界面顶部,同时显示复制按钮

    ¥Click on the Save button. The new Transfer token will be displayed at the top of the interface, along with a copy button .

Custom Transfer TokenCustom Transfer Token
提醒

出于安全原因,转移令牌仅在创建后立即显示。刷新页面或在管理面板中导航其他位置时,新创建的转移令牌将被隐藏,并且不会再次显示。

¥For security reasons, Transfer tokens are only shown right after they have been created. When refreshing the page or navigating elsewhere in the admin panel, the newly created Transfer token will be hidden and will not be displayed again.

重新生成转移令牌

¥Regenerating a Transfer token

  1. 单击转移令牌的编辑按钮。

    ¥Click on the Transfer token's edit button.

  2. 单击“重新生成”按钮。

    ¥Click on the Regenerate button.

  3. 单击对话框中的“重新生成”按钮进行确认。

    ¥Click on the Regenerate button to confirm in the dialog.

  4. 复制界面顶部显示的新转移令牌。

    ¥Copy the new Transfer token displayed at the top of the interface.

基于代码的配置

¥Code-based configuration

必须在 config/admin 文件 中定义 transfer.token.salt 值,以便可以正确生成传输令牌。如果未定义任何值,则该功能将被禁用。盐可以是任何长字符串,为了提高安全性,最好将其添加到 环境变量 并使用 env() 实用程序导入,如下例所示:

¥A transfer.token.salt value must be defined in the config/admin file so that transfer tokens can be properly generated. If no value is defined, the feature will be disabled. The salt can be any long string, and for increased security, it's best to add it to the environment variables and import it using the env() utility as in the following example:

/config/admin.js
module.exports = ({ env }) => ({
// …
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT', 'anotherRandomLongString'),
}
},
});

用法

¥Usage

数据管理系统仅基于 CLI,这意味着任何导入、导出或传输命令都必须从终端执行。每个命令的详尽文档可从以下页面访问:

¥The Data Management system is CLI-based only, meaning any import, export, or transfer command must be executed from the terminal. Exhaustive documentation for each command is accessible from the following pages: