grafana/pkg/server/module_runner.go
Kristin Laemmert 0de2c9eb96
feat: add ability to launch targeted dskit modules in the grafana server CLI command (#74188)
* feat: add ability to launch targeted dskit modules in the grafana server CLI command

This commit adds a ModuleServer and ModuleRunner suitable for launching dskit services and updates the server cli command to use this instead of the full Server. The default behavior is unchanged and will launch the full Grafana server. Individual services are targeted by setting target=comma,seperated,list in the config file.

* require dev mode to target dskit modules

* remove unused type

* replace setting.CommandLineArgs w/setting.Cfg; the caller can deal with calling setting.NewCfg

* Update pkg/server/module_server.go

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>

---------

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
2023-09-01 08:09:54 -04:00

26 lines
705 B
Go

package server
import (
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/setting"
)
// ModuleRunner is a simplified version of Runner that is used in the grafana
// server target command. It has a minimal set of dependencies required to
// launch background/dskit services.
type ModuleRunner struct {
Cfg *setting.Cfg
SettingsProvider setting.Provider
Features featuremgmt.FeatureToggles
}
func NewModuleRunner(cfg *setting.Cfg, settingsProvider setting.Provider,
features featuremgmt.FeatureToggles,
) ModuleRunner {
return ModuleRunner{
Cfg: cfg,
SettingsProvider: settingsProvider,
Features: features,
}
}