Skip to content

Commit

Permalink
chore: add local config dir
Browse files Browse the repository at this point in the history
  • Loading branch information
qloog committed Jan 7, 2022
1 parent 2ae1df3 commit d55b942
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 44,4 @@ vendor

# custom
eagle
config/config.yaml
config/local/config.yaml
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 13,8 @@ ENV GO111MODULE=on \
GOOS=linux \
GOARCH=amd64 \
GOPROXY="https://goproxy.cn,direct" \
TZ=Asia/Shanghai
TZ=Asia/Shanghai \
APP_ENV=docer

# 移动到工作目录
WORKDIR /go/src/github.com/go-eagle/eagle
Expand Down
35 changes: 0 additions & 35 deletions config/README.md

This file was deleted.

27 changes: 27 additions & 0 deletions config/local/README.md
Original file line number Diff line number Diff line change
@@ -0,0 1,27 @@
# conf

默认从 config/{ENV} 加载配置, 可以通过下面命令生成:

如果是多环境可以设定不同的配置目录,比如:
- config/local 本地开发环境
- config/test 测试环境
- config/staging 预发布环境
- config/prod 线上环境

> 环境命名参考自:https://cloud.google.com/apis/design/directory_structure
生成测试环境配置文件:

```bash
cp -r config/localhost config/test
```

使用本地配置文件来运行程序,命令如下:

```bash
# 本地启动
# 也可以直接 APP_ENV={env} ./eagle
APP_ENV=local ./eagle -c config
./eagle -e local -c config
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 34,7 @@ require (
github.com/go-redis/redis/v8 v8.11.0
github.com/go-sql-driver/mysql v1.5.0
github.com/go-test/deep v1.0.6
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.2
github.com/google/uuid v1.1.2
github.com/gorilla/sessions v1.2.1
Expand Down

0 comments on commit d55b942

Please sign in to comment.