Skip to content

Commit

Permalink
chore: create config from standalone cloudbeat deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
olegsu committed Nov 9, 2022
1 parent ae573e7 commit 1db972d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}

0 comments on commit 1db972d

Please sign in to comment.