mirror of https://github.com/grafana/grafana.git
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package querycaching
|
|
|
|
import (
|
|
restclient "k8s.io/client-go/rest"
|
|
|
|
"github.com/grafana/grafana-app-sdk/app"
|
|
appsdkapiserver "github.com/grafana/grafana-app-sdk/k8s/apiserver"
|
|
"github.com/grafana/grafana-app-sdk/simple"
|
|
"github.com/grafana/grafana/apps/querycaching/pkg/apis"
|
|
querycachingapp "github.com/grafana/grafana/apps/querycaching/pkg/app"
|
|
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
var (
|
|
_ appsdkapiserver.AppInstaller = (*QueryCachingAppInstaller)(nil)
|
|
)
|
|
|
|
type QueryCachingAppInstaller struct {
|
|
appsdkapiserver.AppInstaller
|
|
cfg *setting.Cfg
|
|
}
|
|
|
|
func RegisterAppInstaller(
|
|
cfg *setting.Cfg,
|
|
features featuremgmt.FeatureToggles,
|
|
) (*QueryCachingAppInstaller, error) {
|
|
installer := &QueryCachingAppInstaller{
|
|
cfg: cfg,
|
|
}
|
|
provider := simple.NewAppProvider(apis.LocalManifest(), nil, querycachingapp.New)
|
|
|
|
appConfig := app.Config{
|
|
KubeConfig: restclient.Config{}, // this will be overridden by the installer's InitializeApp method
|
|
ManifestData: *apis.LocalManifest().ManifestData,
|
|
}
|
|
i, err := appsdkapiserver.NewDefaultAppInstaller(provider, appConfig, apis.NewGoTypeAssociator())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
installer.AppInstaller = i
|
|
|
|
return installer, nil
|
|
}
|