mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 14:42:13 +08:00
K8s: Move standalone apiserver CLI to enterprise (#93799)
This commit is contained in:
@ -21,38 +21,29 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||
"github.com/grafana/grafana/pkg/infra/process"
|
||||
"github.com/grafana/grafana/pkg/server"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/standalone"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
type ServerOptions struct {
|
||||
Version string
|
||||
Commit string
|
||||
EnterpriseCommit string
|
||||
BuildBranch string
|
||||
BuildStamp string
|
||||
Context *cli.Context
|
||||
}
|
||||
|
||||
func ServerCommand(version, commit, enterpriseCommit, buildBranch, buildstamp string) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "server",
|
||||
Usage: "run the grafana server",
|
||||
Flags: commonFlags,
|
||||
Action: func(context *cli.Context) error {
|
||||
return RunServer(ServerOptions{
|
||||
return RunServer(standalone.BuildInfo{
|
||||
Version: version,
|
||||
Commit: commit,
|
||||
EnterpriseCommit: enterpriseCommit,
|
||||
BuildBranch: buildBranch,
|
||||
BuildStamp: buildstamp,
|
||||
Context: context,
|
||||
})
|
||||
}, context)
|
||||
},
|
||||
Subcommands: []*cli.Command{TargetCommand(version, commit, buildBranch, buildstamp)},
|
||||
}
|
||||
}
|
||||
|
||||
func RunServer(opts ServerOptions) error {
|
||||
func RunServer(opts standalone.BuildInfo, cli *cli.Context) error {
|
||||
if Version || VerboseVersion {
|
||||
if opts.EnterpriseCommit != gcli.DefaultCommitValue && opts.EnterpriseCommit != "" {
|
||||
fmt.Printf("Version %s (commit: %s, branch: %s, enterprise-commit: %s)\n", opts.Version, opts.Commit, opts.BuildBranch, opts.EnterpriseCommit)
|
||||
@ -106,7 +97,7 @@ func RunServer(opts ServerOptions) error {
|
||||
Config: ConfigFile,
|
||||
HomePath: HomePath,
|
||||
// tailing arguments have precedence over the options string
|
||||
Args: append(configOptions, opts.Context.Args().Slice()...),
|
||||
Args: append(configOptions, cli.Args().Slice()...),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user