Add PolylithMode base config option

This commit is contained in:
Neil Alexander 2022-05-06 13:06:51 +01:00
parent a1a5357f79
commit e4471631e1
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 6 additions and 3 deletions

View file

@ -71,8 +71,8 @@ func main() {
logrus.Infof("Starting %q component", component)
base := base.NewBaseDendrite(cfg, component) // TODO
defer base.Close() // nolint: errcheck
base := base.NewBaseDendrite(cfg, component, base.PolylithMode) // TODO
defer base.Close() // nolint: errcheck
go start(base, cfg)
base.WaitForShutdown()

View file

@ -96,6 +96,7 @@ type BaseDendriteOptions int
const (
NoCacheMetrics BaseDendriteOptions = iota
UseHTTPAPIs
PolylithMode
)
// NewBaseDendrite creates a new instance to be used by a component.
@ -105,17 +106,19 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
platformSanityChecks()
useHTTPAPIs := false
cacheMetrics := true
isMonolith := true
for _, opt := range options {
switch opt {
case NoCacheMetrics:
cacheMetrics = false
case UseHTTPAPIs:
useHTTPAPIs = true
case PolylithMode:
isMonolith = false
}
}
configErrors := &config.ConfigErrors{}
isMonolith := componentName == "Monolith" // TODO: better way?
cfg.Verify(configErrors, isMonolith)
if len(*configErrors) > 0 {
for _, err := range *configErrors {