summaryrefslogtreecommitdiff
path: root/internal/cli
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2022-03-09 09:09:46 +0100
committerValery Piashchynski <[email protected]>2022-03-09 09:09:46 +0100
commitac021525b68512f2d855ec7a870a0d2086a5f318 (patch)
tree30dd607d2f8c88b34871248eeb421c0a0c1fc69b /internal/cli
parent1c5a6a590832bbefb2cab99a81f413a5a0e756de (diff)
viper auto envs and ${} syntax support for the internal RPC client
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'internal/cli')
-rw-r--r--internal/cli/reset/command.go4
-rw-r--r--internal/cli/reset/command_test.go2
-rw-r--r--internal/cli/root.go4
-rw-r--r--internal/cli/workers/command.go4
-rw-r--r--internal/cli/workers/command_test.go4
5 files changed, 9 insertions, 9 deletions
diff --git a/internal/cli/reset/command.go b/internal/cli/reset/command.go
index a0634c31..ce29d248 100644
--- a/internal/cli/reset/command.go
+++ b/internal/cli/reset/command.go
@@ -17,7 +17,7 @@ import (
var spinnerStyle = []string{"∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"} //nolint:gochecknoglobals
// NewCommand creates `reset` command.
-func NewCommand(cfgFile *string) *cobra.Command { //nolint:funlen
+func NewCommand(cfgFile *string, override *[]string) *cobra.Command { //nolint:funlen
return &cobra.Command{
Use: "reset",
Short: "Reset workers of all or specific RoadRunner service",
@@ -32,7 +32,7 @@ func NewCommand(cfgFile *string) *cobra.Command { //nolint:funlen
return errors.E(op, errors.Str("no configuration file provided"))
}
- client, err := internalRpc.NewClient(*cfgFile)
+ client, err := internalRpc.NewClient(*cfgFile, *override)
if err != nil {
return err
}
diff --git a/internal/cli/reset/command_test.go b/internal/cli/reset/command_test.go
index ca68cb54..57801453 100644
--- a/internal/cli/reset/command_test.go
+++ b/internal/cli/reset/command_test.go
@@ -10,7 +10,7 @@ import (
func TestCommandProperties(t *testing.T) {
path := ""
- cmd := reset.NewCommand(&path)
+ cmd := reset.NewCommand(&path, nil)
assert.Equal(t, "reset", cmd.Use)
assert.NotNil(t, cmd.RunE)
diff --git a/internal/cli/root.go b/internal/cli/root.go
index 0f35d416..07fc891c 100644
--- a/internal/cli/root.go
+++ b/internal/cli/root.go
@@ -91,8 +91,8 @@ func NewCommand(cmdName string) *cobra.Command { //nolint:funlen
f.StringArrayVarP(override, "override", "o", nil, "override config value (dot.notation=value)")
cmd.AddCommand(
- workers.NewCommand(cfgFile),
- reset.NewCommand(cfgFile),
+ workers.NewCommand(cfgFile, override),
+ reset.NewCommand(cfgFile, override),
serve.NewCommand(override, cfgFile, silent),
)
diff --git a/internal/cli/workers/command.go b/internal/cli/workers/command.go
index f498b7af..78d8d1d2 100644
--- a/internal/cli/workers/command.go
+++ b/internal/cli/workers/command.go
@@ -19,7 +19,7 @@ import (
)
// NewCommand creates `workers` command.
-func NewCommand(cfgFile *string) *cobra.Command { //nolint:funlen
+func NewCommand(cfgFile *string, override *[]string) *cobra.Command { //nolint:funlen
var (
// interactive workers updates
interactive bool
@@ -38,7 +38,7 @@ func NewCommand(cfgFile *string) *cobra.Command { //nolint:funlen
return errors.E(op, errors.Str("no configuration file provided"))
}
- client, err := internalRpc.NewClient(*cfgFile)
+ client, err := internalRpc.NewClient(*cfgFile, *override)
if err != nil {
return err
}
diff --git a/internal/cli/workers/command_test.go b/internal/cli/workers/command_test.go
index a3d144df..c68ec9b1 100644
--- a/internal/cli/workers/command_test.go
+++ b/internal/cli/workers/command_test.go
@@ -9,14 +9,14 @@ import (
)
func TestCommandProperties(t *testing.T) {
- cmd := workers.NewCommand(nil)
+ cmd := workers.NewCommand(nil, nil)
assert.Equal(t, "workers", cmd.Use)
assert.NotNil(t, cmd.RunE)
}
func TestCommandFlags(t *testing.T) {
- cmd := workers.NewCommand(nil)
+ cmd := workers.NewCommand(nil, nil)
cases := []struct {
giveName string