mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 11:02:13 +08:00
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>
This commit is contained in:
@ -50,12 +50,17 @@ func runDbCommand(command func(commandLine utils.CommandLine, sqlStore db.DB) er
|
||||
|
||||
func initializeRunner(cmd *utils.ContextCommandLine) (server.Runner, error) {
|
||||
configOptions := strings.Split(cmd.String("configOverrides"), " ")
|
||||
runner, err := server.InitializeForCLI(setting.CommandLineArgs{
|
||||
cfg, err := setting.NewCfgFromArgs(setting.CommandLineArgs{
|
||||
Config: cmd.ConfigFile(),
|
||||
HomePath: cmd.HomePath(),
|
||||
// tailing arguments have precedence over the options string
|
||||
Args: append(configOptions, cmd.Args().Slice()...),
|
||||
})
|
||||
if err != nil {
|
||||
return server.Runner{}, err
|
||||
}
|
||||
|
||||
runner, err := server.InitializeForCLI(cfg)
|
||||
if err != nil {
|
||||
return server.Runner{}, fmt.Errorf("%v: %w", "failed to initialize runner", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user