code: func (c *Config) CheckAndSetDefaults() error {
  	if c.Events == nil {
  		return trace.BadParameter("missing Events parameter")
  	}
  	if c.Backend == nil {
  		return trace.BadParameter("missing Backend parameter")
  	}
  	if c.OnlyRecent.Enabled && c.PreferRecent.Enabled {
  		return trace.BadParameter("either one of OnlyRecent or PreferRecent should be enabled at a time")
  	}
  	if !c.OnlyRecent.Enabled && !c.PreferRecent.Enabled {
  		c.OnlyRecent.Enabled = true
  	}
  	if err := c.PreferRecent.CheckAndSetDefaults(); err != nil {
  		return trace.Wrap(err)
  	}
  	if c.Context == nil {
  		c.Context = context.Background()
  	}
  	if c.Clock == nil {
  		c.Clock = clockwork.NewRealClock()
  	}
  	if c.RetryPeriod == 0 {
  		c.RetryPeriod = defaults.HighResPollingPeriod
  	}
  	if c.ReloadPeriod == 0 {
  		c.ReloadPeriod = defaults.LowResPollingPeriod
  	}
  	if c.Component == "" {
  		c.Component = teleport.ComponentCache
  	}
  	return nil
  }
docs: // CheckAndSetDefaults checks parameters and sets default values