Skip to content

Commit

Permalink
Addressing code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
safaci2000 committed Jul 12, 2023
1 parent ba37856 commit 40c8378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ var uploadDashboard = &cobra.Command{
if !skipConfirmAction {
tools.GetUserConfirmation(fmt.Sprintf("WARNING: this will delete all dashboards from the monitored folders: '%s' "+
"(or all folders if ignore_dashboard_filters is set to true) and upload your local copy. Do you wish to "+

"continue (y/n) ", strings.Join(apphelpers.GetCtxDefaultGrafanaConfig().GetMonitoredFolders(), ", "),
"continue (y/n) ", strings.Join(config.Config().GetDefaultGrafanaConfig().GetMonitoredFolders(), ", "),
), "", true)
}
grafanaSvc.ExportDashboards(filter)
Expand Down
5 changes: 3 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ func (s *Configuration) ClearContexts() {
// GetDefaultGrafanaConfig returns the default aka. selected grafana config
func (s *Configuration) GetDefaultGrafanaConfig() *GrafanaConfig {
name := s.GetAppConfig().GetContext()

val, ok := s.GetAppConfig().GetContexts()[name]
if ok {
return val
} else {
log.Fatal("Context is not found. Please check your config")
log.Fatalf("Context: '%s' is not found. Please check your config", name)
}
return nil

Expand All @@ -71,7 +72,7 @@ func (s *Configuration) CopyContext(src, dest string) {
}
cfg, ok := contexts[src]
if !ok {
log.Fatal("Cannot set context. No valid configuration found in importer.yml")
log.Fatalf("Cannot find context to: '%s'. No valid configuration found in importer.yml", src)
}
newCopy, err := tools.DeepCopy(*cfg)
if err != nil {
Expand Down

0 comments on commit 40c8378

Please sign in to comment.