Skip to content

Commit

Permalink
CHANGE: naming adjustents
Browse files Browse the repository at this point in the history
+ make release
  • Loading branch information
Ivan Goncharov committed Nov 13, 2019
1 parent e9e8a93 commit 56f4e55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ test:
build:
GO111MODULE=on CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/imorph/gate-keeper/pkg/version.REVISION=$(GIT_COMMIT) -X github.com/imorph/gate-keeper/pkg/version.APPNAME=$(NAME)" -a -o ./bin/gk ./cmd/gk/*
# GO111MODULE=on GIT_COMMIT=$(git rev-list -1 HEAD) && GO111MODULE=on CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/imorph/gate-keeper/pkg/version.REVISION=$(GIT_COMMIT) -X github.com/imorph/gate-keeper/pkg/version.APPNAME=$(CLI_NAME)" -a -o ./bin/gkcli ./cmd/gkcli/*

release:
git tag $(VERSION)
git push origin $(VERSION)
16 changes: 7 additions & 9 deletions cmd/gk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ func run() error {
startTime := time.Now()

var cfg struct {
Srv struct {
APIhost string `conf:"default:127.0.0.1:10001"`
LogLevel string `conf:"default:info"`
}
ListenHost string `conf:"default:127.0.0.1:10001"`
LogLevel string `conf:"default:info"`
}

if err := conf.Parse(os.Args[1:], "GATE-KEEPER", &cfg); err != nil {
if err := conf.Parse(os.Args[1:], "GK", &cfg); err != nil {
if err == conf.ErrHelpWanted {
usage, err := conf.Usage("GATE-KEEPER", &cfg)
usage, err := conf.Usage("GK", &cfg)
if err != nil {
return errors.Wrap(err, "generating config usage")
}
Expand All @@ -44,7 +42,7 @@ func run() error {
}

// configure logging
logger, _ := initZap(cfg.Srv.LogLevel)
logger, _ := initZap(cfg.LogLevel)
defer func() {
err := logger.Sync()
if err != nil {
Expand All @@ -57,8 +55,8 @@ func run() error {

logger.Info("Application started",
zap.Duration("startup_duration", time.Since(startTime)),
zap.String("listen_address", cfg.Srv.APIhost),
zap.String("log_level", cfg.Srv.LogLevel),
zap.String("listen_address", cfg.ListenHost),
zap.String("log_level", cfg.LogLevel),
zap.String("app_name", version.GetAppName()),
zap.String("version", version.GetVersion()),
zap.String("revision", version.GetRevision()),
Expand Down
4 changes: 2 additions & 2 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package version

var APPNAME = "gk"
var VERSION = "0.0.1"
var APPNAME = "unknown"
var VERSION = "v0.0.1"

var REVISION = "unknown"

Expand Down

0 comments on commit 56f4e55

Please sign in to comment.