Skip to content

Commit

Permalink
locate config file
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhipeng committed Aug 9, 2021
1 parent 6241655 commit bb364f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/goctl/api/gogen/genetc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

const (
defaultPort = 8888
defaultPort = 8080
etcDir = "etc"
etcTemplate = `Name: {{.serviceName}}
Host: {{.host}}
Expand Down
4 changes: 4 additions & 0 deletions tools/goctl/api/gogen/genmain.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const mainTemplate = `package main
import (
"flag"
"fmt"
"os"
{{.importPackages}}
)
Expand All @@ -26,6 +27,9 @@ func main() {
flag.Parse()
var c config.Config
if env := os.Getenv("ENV"); env != "" {
*configFile = "etc/{{.serviceName}}-" + env + ".yaml"
}
conf.MustLoad(*configFile, &c)
ctx := svc.NewServiceContext(c)
Expand Down
2 changes: 1 addition & 1 deletion tools/goctl/goctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

var (
buildVersion = "1.2.2"
buildVersion = "1.2.3"
commands = []cli.Command{
{
Name: "upgrade",
Expand Down
2 changes: 1 addition & 1 deletion tools/goctl/rpc/generator/genetc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const etcTemplate = `Name: {{.serviceName}}.rpc
ListenOn: 127.0.0.1:8080
ListenOn: 127.0.0.1:8090
`

// GenEtc generates the yaml configuration file of the rpc service,
Expand Down

0 comments on commit bb364f7

Please sign in to comment.