MCPcopy Create free account
hub / github.com/monitoror/monitoror / Enable

Method Enable

monitorables/github/github.go:75–96  ·  view source on GitHub ↗
(variantName coreModels.VariantName)

Source from the content-addressed store, hash-verified

73}
74
75func (m *Monitorable) Enable(variantName coreModels.VariantName) {
76 conf := m.config[variantName]
77
78 // Custom UpstreamCacheExpiration only for count because github has no-cache for this query and the rate limit is 30req/Hour
79 countCacheExpiration := time.Millisecond * time.Duration(conf.CountCacheExpiration)
80
81 repository := githubRepository.NewGithubRepository(conf)
82 usecase := githubUsecase.NewGithubUsecase(repository)
83 delivery := githubDelivery.NewGithubDelivery(usecase)
84
85 // EnableTile route to echo
86 routeGroup := m.store.MonitorableRouter.Group("/github", variantName)
87 routeCount := routeGroup.GET("/count", delivery.GetCount, options.WithCustomCacheExpiration(countCacheExpiration))
88 routeChecks := routeGroup.GET("/checks", delivery.GetChecks)
89 routePullRequest := routeGroup.GET("/pullrequest", delivery.GetPullRequest)
90
91 // EnableTile data for config hydration
92 m.countTileEnabler.Enable(variantName, &githubModels.CountParams{}, routeCount.Path)
93 m.checksTileEnabler.Enable(variantName, &githubModels.ChecksParams{}, routeChecks.Path)
94 m.pullRequestTileEnabler.Enable(variantName, &githubModels.PullRequestParams{}, routePullRequest.Path)
95 m.pullRequestGeneratorEnabler.Enable(variantName, &githubModels.PullRequestGeneratorParams{}, usecase.PullRequestsGenerator)
96}

Callers 1

TestNewMonitorableFunction · 0.95

Calls 4

GroupMethod · 0.65
GETMethod · 0.65
EnableMethod · 0.65

Tested by 1

TestNewMonitorableFunction · 0.76