Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed flag config
Browse files Browse the repository at this point in the history
danielbdias committed Sep 15, 2023
1 parent ba35d90 commit 24adb72
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/config/server.go
Original file line number Diff line number Diff line change
@@ -73,12 +73,12 @@ var serverOptions = options{
},
{
key: "testPipelines.triggerExecute.enabled",
defaultValue: true,
defaultValue: "true",
description: "enable local trigger execution",
},
{
key: "testPipelines.traceFetch.enabled",
defaultValue: true,
defaultValue: "true",
description: "enable local trace fetching",
},
}
@@ -145,12 +145,15 @@ func (c *AppConfig) TestPipelineTriggerExecutionEnabled() bool {
c.mu.Lock()
defer c.mu.Unlock()

return c.vp.GetBool("testPipelines.triggerExecute.enabled")
// this config needs to be a string because pflags
// has a strage bug that ignores this field when
// it is set as false
return c.vp.GetString("testPipelines.triggerExecute.enabled") == "true"
}

func (c *AppConfig) TestPipelineTraceFetchingEnabled() bool {
c.mu.Lock()
defer c.mu.Unlock()

return c.vp.GetBool("testPipelines.traceFetch.enabled")
return c.vp.GetString("testPipelines.traceFetch.enabled") == "true"
}
3 changes: 3 additions & 0 deletions server/config/server_test.go
Original file line number Diff line number Diff line change
@@ -20,6 +20,9 @@ func TestServerConfig(t *testing.T) {

assert.Equal(t, false, cfg.InternalTelemetryEnabled())
assert.Equal(t, "", cfg.InternalTelemetryOtelCollectorAddress())

assert.Equal(t, true, cfg.TestPipelineTriggerExecutionEnabled())
assert.Equal(t, true, cfg.TestPipelineTraceFetchingEnabled())
})

t.Run("Flags", func(t *testing.T) {

0 comments on commit 24adb72

Please sign in to comment.