func NewServer()

in lambda/rapi/server.go [49:86]


func NewServer(
	host string,
	port int,
	appCtx appctx.ApplicationContext,
	registrationService core.RegistrationService,
	renderingService *rendering.EventRenderingService,
	telemetryAPIEnabled bool,
	logsSubscriptionAPI telemetry.SubscriptionAPI,
	telemetrySubscriptionAPI telemetry.SubscriptionAPI,
	credentialsService core.CredentialsService,
) *Server {

	exitErrors := make(chan error, 1)

	router := chi.NewRouter()
	router.Mount(version20180601, NewRouter(appCtx, registrationService, renderingService))
	router.Mount(version20200101, ExtensionsRouter(appCtx, registrationService, renderingService))

	if telemetryAPIEnabled {
		router.Mount(version20200815, LogsAPIRouter(registrationService, logsSubscriptionAPI))
		router.Mount(version20220701, TelemetryAPIRouter(registrationService, telemetrySubscriptionAPI))
	} else {
		router.Mount(version20200815, LogsAPIStubRouter())
		router.Mount(version20220701, TelemetryAPIStubRouter())
	}

	if appctx.LoadInitType(appCtx) == appctx.InitCaching {
		router.Mount(version20210423, CredentialsAPIRouter(credentialsService))
	}

	return &Server{
		host:     host,
		port:     port,
		server:   &http.Server{Handler: router, ConnContext: SaveConnInContext},
		listener: nil,
		exit:     exitErrors,
	}
}