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

重大变更描述

🌐 Breaking change description

在 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 中

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

🌐 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_TRANSFER | transfer.remote.enabled || STRAPI_HIDE_STARTUP_MESSAGE | logger.startup.enabled || STRAPI_DISABLE_UPDATE_NOTIFICATION | logger.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
},
},
});