Skip to main content

某些 env 专用配置选项由服务器配置处理

¥Some env-only configuration options are handled by the server configuration

在 Strapi 5 中,一些在 Strapi v4 中仅由环境变量处理的配置选项现在在 服务器配置 文件中处理。

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

 Is this breaking change affecting plugins?No
 Is this breaking change automatically handled by a codemod?No

¥In Strapi 5, some configuration options that were only handled by environment variables in Strapi v4 are now handled in the server configuration file.

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

 Is this breaking change affecting plugins?No
 Is this breaking change automatically handled by a codemod?No

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

以下配置列表仅可从环境中获得:

¥The following list of configurations are only available from the environment:

  • STRAPI_DISABLE_REMOTE_DATA_TRANSFER

  • STRAPI_DISABLE_UPDATE_NOTIFICATION

  • STRAPI_HIDE_STARTUP_MESSAGE

在 Strapi 5 中

¥In Strapi 5

这些配置选项已移至 服务器配置 文件(详情请参阅注释中的表格)。

¥These configuration options have been moved to the server configuration file (see table in the notes for details).


迁移

¥Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

¥This section regroups useful notes and procedures about the introduced breaking change.

注意

¥Notes

Strapi v4 中的以下环境变量名称现在应在 /config/server.js 配置文件 中定义:

¥The following environment variable names in Strapi v4 should now be defined in the /config/server.js configuration file:

Strapi v4 中的环境变量名称Strapi 5 中的服务器配置选项
STRAPI_DISABLE_REMOTE_DATA_TRANSFERtransfer.remote.enabled
STRAPI_HIDE_STARTUP_MESSAGElogger.startup.enabled
STRAPI_DISABLE_UPDATE_NOTIFICATIONlogger.updates.enabled

迁移步骤

¥Migration steps

如果你之前在环境中禁用了列出的环境变量之一,请通过添加适当的值来更新 /config/server.js

¥If you previously disabled one of the listed environment variables in your environment, update the /config/server.js by adding the appropriate values:

/config/server.js
module.exports = ({ env }) => ({
// … other configuration options
transfer: {
remote: {
enabled: false, // disable remote data transfers instead of STRAPI_DISABLE_REMOTE_DATA_TRANSFER
},
},
logger: {
updates: {
enabled: false, // disable update notification logging instead of STRAPI_DISABLE_UPDATE_NOTIFICATION
},
startup: {
enabled: false, // disable startup message instead of STRAPI_HIDE_STARTUP_MESSAGE
},
},
});