Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Welch <[email protected]>
  • Loading branch information
slim-bean committed Apr 3, 2024
1 parent b876cea commit 7123050
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pkg/runtime/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package runtime

import "flag"
import (
"flag"
)

type Config struct {
LogStreamCreation bool `yaml:"log_stream_creation"`
Expand Down Expand Up @@ -44,13 +46,26 @@ type TenantConfigs struct {
}

// DefaultTenantConfigs creates and returns a new TenantConfigs with the defaults populated.
// Only useful for testing, the provider will ignore any tenants passed in.
func DefaultTenantConfigs() *TenantConfigs {
return &TenantConfigs{
TenantConfigProvider: nil,
TenantConfigProvider: &defaultsOnlyConfigProvider{},
}
}

// NewTenantConfig makes a new TenantConfigs
type defaultsOnlyConfigProvider struct {
}

// TenantConfig implementation for defaultsOnlyConfigProvider, ignores the tenant input and only returns a default config
func (t *defaultsOnlyConfigProvider) TenantConfig(_ string) *Config {
if defaultConfig == nil {
defaultConfig = &Config{}
defaultConfig.RegisterFlags(flag.NewFlagSet("", flag.PanicOnError))
}
return defaultConfig
}

// NewTenantConfigs makes a new TenantConfigs
func NewTenantConfigs(configProvider TenantConfigProvider) (*TenantConfigs, error) {
return &TenantConfigs{
TenantConfigProvider: configProvider,
Expand Down

0 comments on commit 7123050

Please sign in to comment.