summaryrefslogtreecommitdiff
path: root/internal/cli/serve
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2023-10-28 12:53:43 +0200
committerValery Piashchynski <[email protected]>2023-10-28 12:53:43 +0200
commit64b4d4feb4b3abe51d8149983060c0090e4fd075 (patch)
tree2c81d7b5383c2aa4852f49d16d28013148e06a25 /internal/cli/serve
parentb5acfd6212252c1977990e88f416b2d813939a03 (diff)
feature: flag to enable/disable experimental features
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'internal/cli/serve')
-rw-r--r--internal/cli/serve/command.go15
-rw-r--r--internal/cli/serve/command_test.go4
2 files changed, 10 insertions, 9 deletions
diff --git a/internal/cli/serve/command.go b/internal/cli/serve/command.go
index a4caa265..95aeb067 100644
--- a/internal/cli/serve/command.go
+++ b/internal/cli/serve/command.go
@@ -21,7 +21,7 @@ const (
)
// NewCommand creates `serve` command.
-func NewCommand(override *[]string, cfgFile *string, silent *bool) *cobra.Command { //nolint:funlen
+func NewCommand(override *[]string, cfgFile *string, silent *bool, experimental *bool) *cobra.Command { //nolint:funlen
return &cobra.Command{
Use: "serve",
Short: "Start RoadRunner server",
@@ -39,11 +39,12 @@ func NewCommand(override *[]string, cfgFile *string, silent *bool) *cobra.Comman
}
cfg := &configImpl.Plugin{
- Path: *cfgFile,
- Prefix: rrPrefix,
- Timeout: containerCfg.GracePeriod,
- Flags: *override,
- Version: meta.Version(),
+ Path: *cfgFile,
+ Prefix: rrPrefix,
+ Timeout: containerCfg.GracePeriod,
+ Flags: *override,
+ Version: meta.Version(),
+ ExperimentalFeatures: *experimental,
}
endureOptions := []endure.Options{
@@ -58,7 +59,7 @@ func NewCommand(override *[]string, cfgFile *string, silent *bool) *cobra.Comman
ll, err := container.ParseLogLevel(containerCfg.LogLevel)
if err != nil {
if !*silent {
- fmt.Printf("[WARN] Failed to parse log level, using default (error): %s\n", err)
+ fmt.Println(fmt.Errorf("[WARN] Failed to parse log level, using default (error): %w", err))
}
}
cont := endure.New(ll, endureOptions...)
diff --git a/internal/cli/serve/command_test.go b/internal/cli/serve/command_test.go
index 69ff64f0..80da3949 100644
--- a/internal/cli/serve/command_test.go
+++ b/internal/cli/serve/command_test.go
@@ -10,14 +10,14 @@ import (
func TestCommandProperties(t *testing.T) {
path := ""
- cmd := serve.NewCommand(nil, &path, nil)
+ cmd := serve.NewCommand(nil, &path, nil, nil)
assert.Equal(t, "serve", cmd.Use)
assert.NotNil(t, cmd.RunE)
}
func TestCommandNil(t *testing.T) {
- cmd := serve.NewCommand(nil, nil, nil)
+ cmd := serve.NewCommand(nil, nil, nil, nil)
assert.Equal(t, "serve", cmd.Use)
assert.NotNil(t, cmd.RunE)