Skip to content

Commit

Permalink
docs: add custom time zone example (#651)
Browse files Browse the repository at this point in the history
使用 Docker 打出的镜像,默认会使用0区时区,会影响到日志、数据库等时间的显示,考虑到全球化,可在镜像运行时,
设置环境变量 `TZ` 即可解决该问题,TZ 列表可参考:[https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)。
  • Loading branch information
hljwkwm authored Feb 21, 2024
1 parent 6b4f9af commit ae83136
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/deploy-in-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ CNPMCORE_LOG_DIR=/var/log/cnpmcore
CNPMCORE_CONFIG_REGISTRY=https://your-registry.com
```

### 时区

时区可以通过环境变量`TZ`来设置,可以使用地区标识符如`Asia/Shanghai`,也可以使用时区标识符如`Etc/GMT-8`(东八区)、`Etc/GMT+8`(西八区),具体TZ列表见[List](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)

```bash
TZ=Asia/Shanghai
```

### 使用 `config.prod.js` 覆盖

直接覆盖 `/usr/src/app/config/config.prod.js` 文件也可以实现生产配置自定义。
Expand Down Expand Up @@ -145,6 +153,7 @@ docker run -p 7001:7001 -it --rm \
-e CNPMCORE_REDIS_PORT=6379 \
-e CNPMCORE_REDIS_PASSWORD=your-redis-password \
-e CNPMCORE_REDIS_DB=1 \
-e TZ=Asia/Shanghai \
--name cnpmcore-prod cnpmcore
```

Expand Down

0 comments on commit ae83136

Please sign in to comment.