# 一些仅环境相关的配置选项由服务器配置处理

> Source: https://strapi.nodejs.cn/cms/migration/v4-to-v5/breaking-changes/removed-support-for-some-env-options

🌐 Some `env`-only configuration options are handled by the server configuration

在 Strapi 5 中，三个环境变量（`STRAPI_DISABLE_REMOTE_DATA_TRANSFER`、`STRAPI_HIDE_STARTUP_MESSAGE`、`STRAPI_DISABLE_UPDATE_NOTIFICATION`）现在通过服务器配置文件而不是环境变量进行配置。

🌐 In Strapi 5, three environment variables (`STRAPI_DISABLE_REMOTE_DATA_TRANSFER`, `STRAPI_HIDE_STARTUP_MESSAGE`, `STRAPI_DISABLE_UPDATE_NOTIFICATION`) are now configured via the server configuration file instead of environment variables.

在 Strapi 5 中，一些在 Strapi v4 中仅由环境变量处理的配置选项现在在 [服务器配置](/cms/configurations/server) 文件中处理。

此页面是[重大更改数据库](/cms/migration/v4-to-v5/breaking-changes)的一部分，提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) 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}

🌐 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 中**

这些配置选项已被移到[服务器配置](/cms/configurations/server)文件中（详情请参阅注释中的表格）。

🌐 These configuration options have been moved to the [server configuration](/cms/configurations/server) file (see table in the notes for details).

<br />

## 迁移 {#migration}

🌐 Migration

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

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

### 注意 {#notes}

🌐 Notes

在 Strapi v4 中，以下环境变量名称现在应在 [`/config/server.js` 配置文件](/cms/configurations/server) 中定义：

🌐 The following environment variable names in Strapi v4 should now be defined in the [`/config/server.js` configuration file](/cms/configurations/server):

| 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}

🌐 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:

```js title="/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
    },
  },
});
```
```js title="/config/server.ts"

  // … 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
    },
  },
});
```
