CMS: Create local implementation of cloud migration for dev use (#86637)
* add developer mode property to config * create cms stub * cleanup * implement and wire up gcom stub * fix errors * don't document the flag
This commit is contained in:
@@ -84,7 +84,6 @@ func ProvideService(
|
||||
cfg: cfg,
|
||||
features: features,
|
||||
dsService: dsService,
|
||||
gcomService: gcom.New(gcom.Config{ApiURL: cfg.GrafanaComAPIURL, Token: cfg.CloudMigration.GcomAPIToken}),
|
||||
tracer: tracer,
|
||||
metrics: newMetrics(),
|
||||
secretsService: secretsService,
|
||||
@@ -93,12 +92,20 @@ func ProvideService(
|
||||
}
|
||||
s.api = api.RegisterApi(routeRegister, s, tracer)
|
||||
|
||||
// get CMS path from the config
|
||||
domain, err := s.parseCloudMigrationConfig()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("config parse error: %w", err)
|
||||
if !cfg.CloudMigration.IsDeveloperMode {
|
||||
// get CMS path from the config
|
||||
domain, err := s.parseCloudMigrationConfig()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("config parse error: %w", err)
|
||||
}
|
||||
s.cmsClient = cmsclient.NewCMSClient(domain)
|
||||
|
||||
s.gcomService = gcom.New(gcom.Config{ApiURL: cfg.GrafanaComAPIURL, Token: cfg.CloudMigration.GcomAPIToken})
|
||||
} else {
|
||||
s.cmsClient = cmsclient.NewInMemoryClient()
|
||||
s.gcomService = &gcomStub{map[string]gcom.AccessPolicy{}}
|
||||
s.cfg.StackID = "12345"
|
||||
}
|
||||
s.cmsClient = cmsclient.NewCMSClient(domain)
|
||||
|
||||
if err := s.registerMetrics(prom, s.metrics); err != nil {
|
||||
s.log.Warn("error registering prom metrics", "error", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user