From 1db972d1fe400196959038814f5d4047fbb04499 Mon Sep 17 00:00:00 2001 From: Oleg Sucharevich Date: Mon, 31 Oct 2022 14:36:12 +0200 Subject: [PATCH] chore: create config from standalone cloudbeat deployment --- config/config.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config/config.go b/config/config.go index c5529a89bb..2dbc765798 100644 --- a/config/config.go +++ b/config/config.go @@ -77,6 +77,9 @@ var DefaultConfig = Stream{ } func New(cfg *config.C) (Config, error) { + if cfg.HasField("streams") { + return newStandaloneConfig(cfg) + } c := DefaultConfig if err := cfg.Unpack(&c); err != nil { return Config{}, err @@ -99,6 +102,22 @@ func Datastream(namespace string, indexPrefix string) string { return indexPrefix + "-" + namespace } +// stanalone config is used for development flows +// see an example deploy/kustomize/overlays/cloudbeat-vanilla/cloudbeat.yml +func newStandaloneConfig(cfg *config.C) (Config, error) { + c := struct { + Period time.Duration + Streams []Stream + }{4 * time.Hour, []Stream{}} + if err := cfg.Unpack(&c); err != nil { + return Config{}, err + } + return Config{ + Type: InputTypeVanillaK8s, + Stream: c.Streams[0], + }, nil +} + type AwsConfigProvider interface { InitializeAWSConfig(ctx context.Context, cfg aws.ConfigAWS) (awssdk.Config, error) }