Update env.md

This commit is contained in:
Zhou 2022-12-21 10:14:32 +08:00 committed by GitHub
parent ec127c8465
commit 3422f56e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,15 @@
# 环境变量 # Environment variables
## 全局环境变量 ## Global environment variables
保存在 `.env` 文件里 Saved in the `.env` file
### APP_ENV ### APP_ENV
应用环境,默认值 `development`,可选项包括: Application environment, default value `development`, options include
- `production` 生产环境 - `production` production environment
- `development` 开发环境 - ``development`` development environment
```bash ```bash
APP_ENV=production APP_ENV=production
@ -17,7 +17,7 @@ APP_ENV=production
### APP_HOST ### APP_HOST
应用主机,默认值 `0.0.0.0` Application host, default value ``0.0.0.0``
```bash ```bash
APP_HOST=192.168.3.154 APP_HOST=192.168.3.154
@ -25,7 +25,7 @@ APP_HOST=192.168.3.154
### APP_PORT ### APP_PORT
应用端口,默认值 `13000` Application port, default value ``13000``
```bash ```bash
APP_PORT=13000 APP_PORT=13000
@ -33,7 +33,7 @@ APP_PORT=13000
### APP_KEY ### APP_KEY
秘钥,用于 jwt 等场景 Secret key, for scenarios such as jwt
```bash ```bash
APP_KEY=app-key-test APP_KEY=app-key-test
@ -41,7 +41,7 @@ APP_KEY=app-key-test
### API_BASE_PATH ### API_BASE_PATH
NocoBase API 地址前缀,默认值 `/api/` NocoBase API address prefix, default value ``/api/``
```bash ```bash
API_BASE_PATH=/api/ API_BASE_PATH=/api/
@ -49,25 +49,25 @@ API_BASE_PATH=/api/
### PLUGIN_PACKAGE_PREFIX ### PLUGIN_PACKAGE_PREFIX
插件包前缀,默认值 `@nocobase/plugin-,@nocobase/preset-` Plugin package prefix, default value `@nocobase/plugin-,@nocobase/preset-`
例如,有一名为 `my-nocobase-app` 的项目,新增了 `hello` 插件,包名为 `@my-nocobase-app/plugin-hello` For example, a project named `my-nocobase-app` adds the `hello` plugin with the package name `@my-nocobase-app/plugin-hello`.
PLUGIN_PACKAGE_PREFIX 配置如下: PLUGIN_PACKAGE_PREFIX is configured as follows.
```bash ```bash
PLUGIN_PACKAGE_PREFIX=@nocobase/plugin-,@nocobase/preset-,@my-nocobase-app/plugin- PLUGIN_PACKAGE_PREFIX=@nocobase/plugin-,@nocobase-preset-,@my-nocobase-app/plugin-
``` ```
插件名和包名的对应关系为: The correspondence between plugin names and package names is
- `users` 插件包名为 `@nocobase/plugin-users` - `users` plugin package name is `@nocobase/plugin-users`
- `nocobase` 插件包名为 `@nocobase/preset-nocobase` - `nocobase` plugin package name is `@nocobase/preset-nocobase`
- `hello` 插件包名为 `@my-nocobase-app/plugin-hello` - `hello` Plugin package named `@my-nocobase-app/plugin-hello`
### DB_DIALECT ### DB_DIALECT
数据库类型,默认值 `sqlite`,可选项包括: Database type, default value `sqlite`, options include
- `sqlite` - `sqlite`
- `mysql` - `mysql`
@ -79,20 +79,20 @@ DB_DIALECT=mysql
### DB_STORAGE ### DB_STORAGE
数据库文件路径(使用 SQLite 数据库时配置) Database file path (configured when using a SQLite database)
```bash ```bash
# 相对路径 ### Relative path
DB_HOST=storage/db/nocobase.db DB_HOST=storage/db/nocobase.db
# 绝对路径 # Absolute path
DB_HOST=/your/path/nocobase.db DB_HOST=/your/path/nocobase.db
``` ```
### DB_HOST ### DB_HOST
数据库主机(使用 mysql 或 postgres 数据库时需要配置) Database host (required when using MySQL or PostgreSQL databases)
默认值 `localhost` Default value ``localhost``
```bash ```bash
DB_HOST=localhost DB_HOST=localhost
@ -100,10 +100,10 @@ DB_HOST=localhost
### DB_PORT ### DB_PORT
数据库端口(使用 mysql 或 postgres 数据库时需要配置) Database port (required when using MySQL or PostgreSQL databases)
- MySQL 默认端口 3306 - MySQL default port 3306
- PostgreSQL 默认端口 5432 - PostgreSQL default port 5432
```bash ```bash
DB_PORT=3306 DB_PORT=3306
@ -111,7 +111,7 @@ DB_PORT=3306
### DB_DATABASE ### DB_DATABASE
数据库名(使用 mysql 或 postgres 数据库时需要配置) Database name (required when using MySQL or PostgreSQL databases)
```bash ```bash
DB_DATABASE=nocobase DB_DATABASE=nocobase
@ -119,7 +119,7 @@ DB_DATABASE=nocobase
### DB_USER ### DB_USER
数据库用户(使用 mysql 或 postgres 数据库时需要配置) Database user (required when using MySQL or PostgreSQL databases)
```bash ```bash
DB_USER=nocobase DB_USER=nocobase
@ -127,7 +127,7 @@ DB_USER=nocobase
### DB_PASSWORD ### DB_PASSWORD
数据库密码(使用 mysql 或 postgres 数据库时需要配置) Database password(required when using MySQL or PostgreSQL databases)
```bash ```bash
DB_PASSWORD=nocobase DB_PASSWORD=nocobase
@ -135,7 +135,7 @@ DB_PASSWORD=nocobase
### DB_TABLE_PREFIX ### DB_TABLE_PREFIX
数据表前缀 Data table prefix
```bash ```bash
DB_TABLE_PREFIX=nocobase_ DB_TABLE_PREFIX=nocobase_
@ -143,10 +143,10 @@ DB_TABLE_PREFIX=nocobase_
### DB_LOGGING ### DB_LOGGING
数据库日志开关,默认值 `off`,可选项包括: Database logging switch, default value ``off``, options include
- `on` 打开 - `on` on
- `off` 关闭 - `off` off
```bash ```bash
DB_LOGGING=on DB_LOGGING=on
@ -154,18 +154,18 @@ DB_LOGGING=on
### LOGGER_TRANSPORT ### LOGGER_TRANSPORT
日志 transport默认值 `console,dailyRotateFile`,可选项 Log transport, default ``console,dailyRotateFile``, options include
- `console` - `console`
- `dailyRotateFile` - `dailyRotateFile`
### DAILY_ROTATE_FILE_DIRNAME ### DAILY_ROTATE_FILE_DIRNAME
`dailyRotateFile` 日志的存储路径,默认为 `storage/logs` `dailyRotateFile` path to store logs, default is `storage/logs`
## 临时环境变量 ## Temporary environment variables
安装 NocoBase 时,可以通过设置临时的环境变量来辅助安装,如: When installing NocoBase, you can assist the installation by setting temporary environment variables, such as
```bash ```bash
yarn cross-env \ yarn cross-env \
@ -175,20 +175,20 @@ yarn cross-env \
INIT_ROOT_NICKNAME="Super Admin" \ INIT_ROOT_NICKNAME="Super Admin" \
nocobase install nocobase install
# 等同于 # Equivalent to
yarn nocobase install \ yarn nocobase install \
--lang=zh-CN \ --lang=zh-CN \
--root-email=demo@nocobase.com \ --root-email=demo@nocobase.com \
--root-password=admin123 \ --root-password=admin123 \
--root-nickname="Super Admin" --root-nickname="Super Admin"
# 等同于 # Equivalent to
yarn nocobase install -l zh-CN -e demo@nocobase.com -p admin123 -n "Super Admin" yarn nocobase install -l zh-CN -e demo@nocobase.com -p admin123 -n "Super Admin"
``` ```
### INIT_APP_LANG ### INIT_APP_LANG
安装时的语言,默认值 `en-US`,可选项包括: Language at installation, default value `en-US`, options include
- `en-US` - `en-US`
- `zh-CN` - `zh-CN`
@ -201,7 +201,7 @@ yarn cross-env \
### INIT_ROOT_EMAIL ### INIT_ROOT_EMAIL
Root 用户邮箱 Root user mailbox
```bash ```bash
yarn cross-env \ yarn cross-env \
@ -212,7 +212,7 @@ yarn cross-env \
### INIT_ROOT_PASSWORD ### INIT_ROOT_PASSWORD
Root 用户密码 Root user password
```bash ```bash
yarn cross-env \ yarn cross-env \
@ -224,7 +224,7 @@ yarn cross-env \
### INIT_ROOT_NICKNAME ### INIT_ROOT_NICKNAME
Root 用户昵称 Root user nickname
```bash ```bash
yarn cross-env \ yarn cross-env \