Skip to content

Commit

Permalink
Allow to set host outside of config. Fixes #157
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Jan 22, 2020
1 parent 9649eb0 commit cdd3528
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/ghz/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ var (
debug = kingpin.Flag("debug", "The path to debug log file.").
PlaceHolder(" ").IsSetByUser(&isDebugSet).String()

host = kingpin.Arg("host", "Host and port to test.").String()
isHostSet = false
host = kingpin.Arg("host", "Host and port to test.").String()
)

func main() {
Expand All @@ -185,6 +186,8 @@ func main() {
kingpin.CommandLine.VersionFlag.Short('v')
kingpin.Parse()

isHostSet = *host != ""

cfgPath := strings.TrimSpace(*cPath)

var cfg config
Expand Down Expand Up @@ -578,6 +581,10 @@ func mergeConfig(dest *config, src *config) error {
dest.Debug = src.Debug
}

if isHostSet {
dest.Host = src.Host
}

return nil
}

Expand Down

0 comments on commit cdd3528

Please sign in to comment.