diff --git a/command/worker/update.go b/command/worker/update.go index 2f48d0fc..802e31a0 100644 --- a/command/worker/update.go +++ b/command/worker/update.go @@ -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