Skip to content

Commit

Permalink
fix(worker): only set active when provided (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper authored Sep 19, 2024
1 parent fcf8c86 commit 53d3633
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions command/worker/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,24 @@ func update(c *cli.Context) error {
return err
}

var active bool

if len(c.String(internal.FlagActive)) > 0 {
active, err = strconv.ParseBool(c.String(internal.FlagActive))
if err != nil {
return err
}
}

// create the worker configuration
w := &worker.Config{
Hostname: c.String(internal.FlagWorkerHostname),
Address: c.String(internal.FlagWorkerAddress),
Active: &active,
Routes: c.StringSlice("routes"),
BuildLimit: c.Int64("build-limit"),
}

// if active flag provided, parse as bool and set in config
if len(c.String(internal.FlagActive)) > 0 {
active, err := strconv.ParseBool(c.String(internal.FlagActive))
if err != nil {
return err
}

w.Active = &active
}

// validate worker configuration
//
// https://pkg.go.dev/github.com/go-vela/cli/action/worker?tab=doc#Config.Validate
Expand Down

0 comments on commit 53d3633

Please sign in to comment.