2018-07-24 09:49:49 -05:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2020-03-30 09:02:20 -05:00
|
|
|
package eduserver
|
2018-07-24 09:49:49 -05:00
|
|
|
|
|
|
|
import (
|
2020-03-30 09:02:20 -05:00
|
|
|
"github.com/matrix-org/dendrite/eduserver/api"
|
|
|
|
"github.com/matrix-org/dendrite/eduserver/cache"
|
|
|
|
"github.com/matrix-org/dendrite/eduserver/input"
|
2020-05-21 08:40:13 -05:00
|
|
|
"github.com/matrix-org/dendrite/internal/basecomponent"
|
2018-07-24 09:49:49 -05:00
|
|
|
)
|
|
|
|
|
2020-03-30 09:02:20 -05:00
|
|
|
// SetupEDUServerComponent sets up and registers HTTP handlers for the
|
|
|
|
// EDUServer component. Returns instances of the various roomserver APIs,
|
2018-07-24 09:49:49 -05:00
|
|
|
// allowing other components running in the same process to hit the query the
|
|
|
|
// APIs directly instead of having to use HTTP.
|
2020-03-30 09:02:20 -05:00
|
|
|
func SetupEDUServerComponent(
|
2018-07-24 09:49:49 -05:00
|
|
|
base *basecomponent.BaseDendrite,
|
2020-03-30 09:02:20 -05:00
|
|
|
eduCache *cache.EDUCache,
|
|
|
|
) api.EDUServerInputAPI {
|
|
|
|
inputAPI := &input.EDUServerInputAPI{
|
|
|
|
Cache: eduCache,
|
2018-08-02 12:22:44 -05:00
|
|
|
Producer: base.KafkaProducer,
|
|
|
|
OutputTypingEventTopic: string(base.Cfg.Kafka.Topics.OutputTypingEvent),
|
|
|
|
}
|
|
|
|
|
2020-05-26 08:41:16 -05:00
|
|
|
inputAPI.SetupHTTP(base.InternalAPIMux)
|
2020-05-18 04:56:43 -05:00
|
|
|
|
2018-08-02 12:22:44 -05:00
|
|
|
return inputAPI
|
2018-07-24 09:49:49 -05:00
|
|
|
}
|