3
- What version of Go and beego are you using (
bee version
)? bee :1.4.1 beego :1.6.1 Go :go version go1.5.1 darwin/amd64 - What operating system and processor architecture are you using (
go env
)? GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/xxy/Documents/go_project" GORACE="" GOROOT="/usr/local/Cellar/go/1.5.1/libexec" GOTOOLDIR="/usr/local/Cellar/go/1.5.1/libexec/pkg/tool/darwin_amd64" GO15VENDOREXPERIMENT="" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common" CXX="clang++" CGO_ENABLED="1" - What did you do? 怎么根据不同的运行环境决定数据库链接?比如说dev环境使用
root:@tcp(localhost:3306)/test
而prod环境使用
user:password@tcp(192.168.1.3:3306)/prod
- What did you expect to see?
我希望可以通过app.conf来指定。比如
[dev]
DbDriver=mysql
DBConn=root:@tcp(localhost:3306)/test
[prod]
DbDriver=mysql
user:password@tcp(192.168.1.3:3306)/prod
- What did you see instead? 没有找到类似的文档~
另外,我希望能够在线上也去做migrate,但是bee的migrate是根据bee.json来的。bee.json同样不区分环境。不知道能不能在一个地方声明好,然后我不管是bee run app 还是 bee migrate 都可以根据 BEEGO_RUNMODE 这个环境变量来切换数据库链接