code: func initMonitor(c context.Context, config config) (monitor.Monitor, error) {
  	if config.Endpoint == "" {
  		logging.Infof(c, "tsmon is disabled because no endpoint is configured")
  		return nil, nil
  	}
  	if strings.ToLower(config.Endpoint) == "none" {
  		logging.Infof(c, "tsmon is explicitly disabled")
  		return nil, nil
  	}
  
  	endpointURL, err := url.Parse(config.Endpoint)
  	if err != nil {
  		return nil, err
  	}
  
  	switch endpointURL.Scheme {
  	case "file":
  		return monitor.NewDebugMonitor(endpointURL.Path), nil
  	case "http", "https":
  		client, err := newAuthenticator(c, config.Credentials, config.ActAs, monitor.ProdxmonScopes).Client()
  		if err != nil {
  			return nil, err
  		}
  
  		return monitor.NewHTTPMonitor(c, client, endpointURL)
  	default:
  		return nil, fmt.Errorf("unknown tsmon endpoint url: %s", config.Endpoint)
  	}
  }
docs: // initMonitor examines flags and config and initializes a monitor.
  //
  // It returns (nil, nil) if tsmon should be disabled.