diff --git a/config/cmd/cmd.go b/config/cmd/cmd.go index 87000a11..ee2d4505 100644 --- a/config/cmd/cmd.go +++ b/config/cmd/cmd.go @@ -692,6 +692,21 @@ func (c *cmd) Before(ctx *cli.Context) error { } } + // Set the selector + if name := ctx.String("selector"); len(name) > 0 && (*c.opts.Selector).String() != name { + s, ok := c.opts.Selectors[name] + if !ok { + logger.Fatalf("Selector %s not found", name) + } + + *c.opts.Selector = s(selectorOpts...) + clientOpts = append(clientOpts, client.Selector(*c.opts.Selector)) + } else if len(selectorOpts) > 0 { + if err := (*c.opts.Selector).Init(selectorOpts...); err != nil { + logger.Fatalf("Error configuring selctor: %v", err) + } + } + // generate the services auth account. // todo: move this so it only runs for new services serverID := (*c.opts.Server).Options().Id @@ -725,21 +740,6 @@ func (c *cmd) Before(ctx *cli.Context) error { } } - // Set the selector - if name := ctx.String("selector"); len(name) > 0 && (*c.opts.Selector).String() != name { - s, ok := c.opts.Selectors[name] - if !ok { - logger.Fatalf("Selector %s not found", name) - } - - *c.opts.Selector = s(selectorOpts...) - clientOpts = append(clientOpts, client.Selector(*c.opts.Selector)) - } else if len(selectorOpts) > 0 { - if err := (*c.opts.Selector).Init(selectorOpts...); err != nil { - logger.Fatalf("Error configuring selctor: %v", err) - } - } - // Setup the transport options var transportOpts []transport.Option if len(ctx.String("transport_address")) > 0 {