summaryrefslogtreecommitdiff
path: root/internal/cli/workers
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2022-03-06 12:13:02 +0100
committerValery Piashchynski <[email protected]>2022-03-06 12:13:02 +0100
commit70e4f020afd0352dc52114651f0f65c1965ed399 (patch)
treecc6595214e4ff39600099fb8c6f39e7a3dd560e9 /internal/cli/workers
parent587702be62b65c151d27dc79e62fcbbd11290e6f (diff)
remove config plugin usage from the root
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'internal/cli/workers')
-rw-r--r--internal/cli/workers/command.go9
-rw-r--r--internal/cli/workers/command_test.go5
2 files changed, 8 insertions, 6 deletions
diff --git a/internal/cli/workers/command.go b/internal/cli/workers/command.go
index e3f8f7e3..f498b7af 100644
--- a/internal/cli/workers/command.go
+++ b/internal/cli/workers/command.go
@@ -13,14 +13,13 @@ import (
tm "github.com/buger/goterm"
"github.com/fatih/color"
- "github.com/roadrunner-server/config/v2"
"github.com/roadrunner-server/errors"
"github.com/roadrunner-server/informer/v2"
"github.com/spf13/cobra"
)
// NewCommand creates `workers` command.
-func NewCommand(cfgPlugin *config.Plugin) *cobra.Command { //nolint:funlen
+func NewCommand(cfgFile *string) *cobra.Command { //nolint:funlen
var (
// interactive workers updates
interactive bool
@@ -35,7 +34,11 @@ func NewCommand(cfgPlugin *config.Plugin) *cobra.Command { //nolint:funlen
informerList = "informer.List"
)
- client, err := internalRpc.NewClient(cfgPlugin)
+ if cfgFile == nil {
+ return errors.E(op, errors.Str("no configuration file provided"))
+ }
+
+ client, err := internalRpc.NewClient(*cfgFile)
if err != nil {
return err
}
diff --git a/internal/cli/workers/command_test.go b/internal/cli/workers/command_test.go
index d0c92e63..a3d144df 100644
--- a/internal/cli/workers/command_test.go
+++ b/internal/cli/workers/command_test.go
@@ -5,19 +5,18 @@ import (
"github.com/roadrunner-server/roadrunner/v2/internal/cli/workers"
- "github.com/roadrunner-server/config/v2"
"github.com/stretchr/testify/assert"
)
func TestCommandProperties(t *testing.T) {
- cmd := workers.NewCommand(&config.Plugin{})
+ cmd := workers.NewCommand(nil)
assert.Equal(t, "workers", cmd.Use)
assert.NotNil(t, cmd.RunE)
}
func TestCommandFlags(t *testing.T) {
- cmd := workers.NewCommand(&config.Plugin{})
+ cmd := workers.NewCommand(nil)
cases := []struct {
giveName string