config/cmd: fix selector setup bug (#1723)
This commit is contained in:
parent
ece02a6d21
commit
2b889087bd
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user