Skip to content

Commit

Permalink
fix: Set default shipping method if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Oct 3, 2024
1 parent 5610c36 commit f053759
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 6 deletions.
8 changes: 7 additions & 1 deletion pkg/cannon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,18 @@ func (c *Config) CreateSinks(log logrus.FieldLogger) ([]output.Sink, error) {
sinks := make([]output.Sink, len(c.Outputs))

for i, out := range c.Outputs {
if out.ShippingMethod == nil {
shippingMethod := processor.ShippingMethodSync

out.ShippingMethod = &shippingMethod
}

sink, err := output.NewSink(out.Name,
out.SinkType,
out.Config,
log,
out.FilterConfig,
processor.ShippingMethodSync,
*out.ShippingMethod,
)
if err != nil {
return nil, err
Expand Down
7 changes: 6 additions & 1 deletion pkg/clmimicry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,18 @@ func (c *Config) CreateSinks(log logrus.FieldLogger) ([]output.Sink, error) {
sinks := make([]output.Sink, len(c.Outputs))

for i, out := range c.Outputs {
if out.ShippingMethod == nil {
shippingMethod := processor.ShippingMethodAsync
out.ShippingMethod = &shippingMethod
}

sink, err := output.NewSink(
out.Name,
out.SinkType,
out.Config,
log,
out.FilterConfig,
processor.ShippingMethodAsync,
*out.ShippingMethod,
)
if err != nil {
return nil, err
Expand Down
7 changes: 6 additions & 1 deletion pkg/mimicry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ func (c *Config) CreateSinks(log logrus.FieldLogger) ([]output.Sink, error) {
sinks := make([]output.Sink, len(c.Outputs))

for i, out := range c.Outputs {
if out.ShippingMethod == nil {
shippingMethod := processor.ShippingMethodAsync
out.ShippingMethod = &shippingMethod
}

sink, err := output.NewSink(
out.Name,
out.SinkType,
out.Config,
log,
out.FilterConfig,
processor.ShippingMethodAsync,
*out.ShippingMethod,
)
if err != nil {
return nil, err
Expand Down
2 changes: 2 additions & 0 deletions pkg/output/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type Config struct {
Config *RawMessage `yaml:"config"`

FilterConfig pxatu.EventFilterConfig `yaml:"filter"`

ShippingMethod *processor.ShippingMethod `yaml:"shippingMethod"`
}

func (c *Config) Validate() error {
Expand Down
7 changes: 6 additions & 1 deletion pkg/relaymonitor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ func (c *Config) CreateSinks(log logrus.FieldLogger) ([]output.Sink, error) {
sinks := make([]output.Sink, len(c.Outputs))

for i, out := range c.Outputs {
if out.ShippingMethod == nil {
shippingMethod := processor.ShippingMethodAsync
out.ShippingMethod = &shippingMethod
}

sink, err := output.NewSink(
out.Name,
out.SinkType,
out.Config,
log,
out.FilterConfig,
processor.ShippingMethodAsync,
*out.ShippingMethod,
)
if err != nil {
return nil, err
Expand Down
7 changes: 6 additions & 1 deletion pkg/sentry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ func (c *Config) CreateSinks(log logrus.FieldLogger) ([]output.Sink, error) {
sinks := make([]output.Sink, len(c.Outputs))

for i, out := range c.Outputs {
if out.ShippingMethod == nil {
shippingMethod := processor.ShippingMethodAsync
out.ShippingMethod = &shippingMethod
}

sink, err := output.NewSink(out.Name,
out.SinkType,
out.Config,
log,
out.FilterConfig,
processor.ShippingMethodAsync,
*out.ShippingMethod,
)
if err != nil {
return nil, err
Expand Down
7 changes: 6 additions & 1 deletion pkg/server/service/event-ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,17 @@ func (e *Ingester) CreateSinks() ([]output.Sink, error) {
sinks := make([]output.Sink, len(e.config.Outputs))

for i, out := range e.config.Outputs {
if out.ShippingMethod == nil {
shippingMethod := processor.ShippingMethodAsync
out.ShippingMethod = &shippingMethod
}

sink, err := output.NewSink(out.Name,
out.SinkType,
out.Config,
e.log,
out.FilterConfig,
processor.ShippingMethodSync,
*out.ShippingMethod,
)
if err != nil {
return nil, err
Expand Down

0 comments on commit f053759

Please sign in to comment.