build: support selecting environment config file
This commit is contained in:
13
README.md
13
README.md
@@ -20,6 +20,19 @@ make build ARCH=arm64
|
||||
|
||||
如需交叉编译其他操作系统,可同时设置 `GOOS`,例如 `make build GOOS=linux ARCH=arm64`。
|
||||
|
||||
构建时可以指定随产物携带的环境文件。基础配置和该文件会复制到 `bin/configs/`:
|
||||
|
||||
```bash
|
||||
make build ENV_FILE=config.test.yml
|
||||
make build ENV_FILE=config.prod.yml ARCH=arm64
|
||||
```
|
||||
|
||||
使用构建产物启动指定环境时,环境变量仍会覆盖文件中的配置:
|
||||
|
||||
```bash
|
||||
./bin/main -config-dir bin/configs -env prod
|
||||
```
|
||||
|
||||
默认配置位于 `configs/config.yml`,可以通过环境变量覆盖。
|
||||
|
||||
## Docker Compose 运行
|
||||
|
||||
Reference in New Issue
Block a user