Add PolylithMode
base config option (#2428)
* Add `PolylithMode` base config option * Polylith mode always uses HTTP APIs
This commit is contained in:
parent
a1a5357f79
commit
507f63d0fc
|
@ -71,7 +71,7 @@ func main() {
|
||||||
|
|
||||||
logrus.Infof("Starting %q component", component)
|
logrus.Infof("Starting %q component", component)
|
||||||
|
|
||||||
base := base.NewBaseDendrite(cfg, component) // TODO
|
base := base.NewBaseDendrite(cfg, component, base.PolylithMode) // TODO
|
||||||
defer base.Close() // nolint: errcheck
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
go start(base, cfg)
|
go start(base, cfg)
|
||||||
|
|
|
@ -96,6 +96,7 @@ type BaseDendriteOptions int
|
||||||
const (
|
const (
|
||||||
NoCacheMetrics BaseDendriteOptions = iota
|
NoCacheMetrics BaseDendriteOptions = iota
|
||||||
UseHTTPAPIs
|
UseHTTPAPIs
|
||||||
|
PolylithMode
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewBaseDendrite creates a new instance to be used by a component.
|
// NewBaseDendrite creates a new instance to be used by a component.
|
||||||
|
@ -105,17 +106,20 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
||||||
platformSanityChecks()
|
platformSanityChecks()
|
||||||
useHTTPAPIs := false
|
useHTTPAPIs := false
|
||||||
cacheMetrics := true
|
cacheMetrics := true
|
||||||
|
isMonolith := true
|
||||||
for _, opt := range options {
|
for _, opt := range options {
|
||||||
switch opt {
|
switch opt {
|
||||||
case NoCacheMetrics:
|
case NoCacheMetrics:
|
||||||
cacheMetrics = false
|
cacheMetrics = false
|
||||||
case UseHTTPAPIs:
|
case UseHTTPAPIs:
|
||||||
useHTTPAPIs = true
|
useHTTPAPIs = true
|
||||||
|
case PolylithMode:
|
||||||
|
isMonolith = false
|
||||||
|
useHTTPAPIs = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configErrors := &config.ConfigErrors{}
|
configErrors := &config.ConfigErrors{}
|
||||||
isMonolith := componentName == "Monolith" // TODO: better way?
|
|
||||||
cfg.Verify(configErrors, isMonolith)
|
cfg.Verify(configErrors, isMonolith)
|
||||||
if len(*configErrors) > 0 {
|
if len(*configErrors) > 0 {
|
||||||
for _, err := range *configErrors {
|
for _, err := range *configErrors {
|
||||||
|
|
Loading…
Reference in a new issue