mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
39 lines
918 B
Go
39 lines
918 B
Go
|
package comments
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/grafana/grafana/pkg/services/comments/commentmodel"
|
||
|
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||
|
"github.com/grafana/grafana/pkg/services/live"
|
||
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||
|
"github.com/grafana/grafana/pkg/setting"
|
||
|
)
|
||
|
|
||
|
type Service struct {
|
||
|
cfg *setting.Cfg
|
||
|
live *live.GrafanaLive
|
||
|
sqlStore *sqlstore.SQLStore
|
||
|
storage Storage
|
||
|
permissions *commentmodel.PermissionChecker
|
||
|
}
|
||
|
|
||
|
func ProvideService(cfg *setting.Cfg, store *sqlstore.SQLStore, live *live.GrafanaLive, features featuremgmt.FeatureToggles) *Service {
|
||
|
s := &Service{
|
||
|
cfg: cfg,
|
||
|
live: live,
|
||
|
sqlStore: store,
|
||
|
storage: &sqlStorage{
|
||
|
sql: store,
|
||
|
},
|
||
|
permissions: commentmodel.NewPermissionChecker(store, features),
|
||
|
}
|
||
|
return s
|
||
|
}
|
||
|
|
||
|
// Run Service.
|
||
|
func (s *Service) Run(ctx context.Context) error {
|
||
|
<-ctx.Done()
|
||
|
return ctx.Err()
|
||
|
}
|