mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-20 21:33:19 -06:00
Only start HTTP APIs if needed
This commit is contained in:
parent
862e9bf87c
commit
8d93710f94
|
|
@ -82,7 +82,9 @@ func SetupAppServiceAPIComponent(
|
||||||
Cfg: base.Cfg,
|
Cfg: base.Cfg,
|
||||||
}
|
}
|
||||||
|
|
||||||
appserviceQueryAPI.SetupHTTP(http.DefaultServeMux)
|
if base.EnableHTTPAPIs {
|
||||||
|
appserviceQueryAPI.SetupHTTP(http.DefaultServeMux)
|
||||||
|
}
|
||||||
|
|
||||||
consumer := consumers.NewOutputRoomEventConsumer(
|
consumer := consumers.NewOutputRoomEventConsumer(
|
||||||
base.Cfg, base.KafkaConsumer, accountsDB, appserviceDB,
|
base.Cfg, base.KafkaConsumer, accountsDB, appserviceDB,
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,12 @@ import (
|
||||||
// should only be used during start up.
|
// should only be used during start up.
|
||||||
// Must be closed when shutting down.
|
// Must be closed when shutting down.
|
||||||
type BaseDendrite struct {
|
type BaseDendrite struct {
|
||||||
componentName string
|
componentName string
|
||||||
enableHTTPAPIs bool
|
tracerCloser io.Closer
|
||||||
tracerCloser io.Closer
|
|
||||||
|
|
||||||
// APIMux should be used to register new public matrix api endpoints
|
// APIMux should be used to register new public matrix api endpoints
|
||||||
APIMux *mux.Router
|
APIMux *mux.Router
|
||||||
|
EnableHTTPAPIs bool
|
||||||
httpClient *http.Client
|
httpClient *http.Client
|
||||||
Cfg *config.Dendrite
|
Cfg *config.Dendrite
|
||||||
ImmutableCache caching.ImmutableCache
|
ImmutableCache caching.ImmutableCache
|
||||||
|
|
@ -97,7 +97,7 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, enableHTTPAPIs
|
||||||
|
|
||||||
return &BaseDendrite{
|
return &BaseDendrite{
|
||||||
componentName: componentName,
|
componentName: componentName,
|
||||||
enableHTTPAPIs: enableHTTPAPIs,
|
EnableHTTPAPIs: enableHTTPAPIs,
|
||||||
tracerCloser: closer,
|
tracerCloser: closer,
|
||||||
Cfg: cfg,
|
Cfg: cfg,
|
||||||
ImmutableCache: cache,
|
ImmutableCache: cache,
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ func SetupEDUServerComponent(
|
||||||
OutputTypingEventTopic: string(base.Cfg.Kafka.Topics.OutputTypingEvent),
|
OutputTypingEventTopic: string(base.Cfg.Kafka.Topics.OutputTypingEvent),
|
||||||
}
|
}
|
||||||
|
|
||||||
inputAPI.SetupHTTP(http.DefaultServeMux)
|
if base.EnableHTTPAPIs {
|
||||||
|
inputAPI.SetupHTTP(http.DefaultServeMux)
|
||||||
|
}
|
||||||
|
|
||||||
return inputAPI
|
return inputAPI
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,10 @@ func SetupFederationSenderComponent(
|
||||||
federationSenderDB, base.Cfg, roomserverProducer, federation, keyRing,
|
federationSenderDB, base.Cfg, roomserverProducer, federation, keyRing,
|
||||||
statistics,
|
statistics,
|
||||||
)
|
)
|
||||||
queryAPI.SetupHTTP(http.DefaultServeMux)
|
|
||||||
|
if base.EnableHTTPAPIs {
|
||||||
|
queryAPI.SetupHTTP(http.DefaultServeMux)
|
||||||
|
}
|
||||||
|
|
||||||
return queryAPI
|
return queryAPI
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,9 @@ func SetupRoomServerComponent(
|
||||||
KeyRing: keyRing,
|
KeyRing: keyRing,
|
||||||
}
|
}
|
||||||
|
|
||||||
internalAPI.SetupHTTP(http.DefaultServeMux)
|
if base.EnableHTTPAPIs {
|
||||||
|
internalAPI.SetupHTTP(http.DefaultServeMux)
|
||||||
|
}
|
||||||
|
|
||||||
return &internalAPI
|
return &internalAPI
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue