code: func (s *serviceConfigWatch) mergeServiceConfig() (*structs.NodeService, error) {
  	if s.defaults == nil || !s.registration.service.IsSidecarProxy() {
  		return s.registration.service, nil
  	}
  
  	// We don't want to change s.registration in place since it is our source of
  	// truth about what was actually registered before defaults applied. So copy
  	// it first.
  	nsRaw, err := copystructure.Copy(s.registration.service)
  	if err != nil {
  		return nil, err
  	}
  
  	// Merge proxy defaults
  	ns := nsRaw.(*structs.NodeService)
  
  	if err := mergo.Merge(&ns.Proxy.Config, s.defaults.ProxyConfig); err != nil {
  		return nil, err
  	}
  	// Merge upstream defaults if there were any returned
  	for i := range ns.Proxy.Upstreams {
  		// Get a pointer not a value copy of the upstream struct
  		us := &ns.Proxy.Upstreams[i]
  		if us.DestinationType != "" && us.DestinationType != structs.UpstreamDestTypeService {
  			continue
  		}
  		usCfg, ok := s.defaults.UpstreamConfigs[us.DestinationName]
  		if !ok {
  			// No config defaults to merge
  			continue
  		}
  		if err := mergo.Merge(&us.Config, usCfg); err != nil {
  			return nil, err
  		}
  	}
  	return ns, err
  }
docs: // mergeServiceConfig returns the final effective config for the watched service,
  // including the latest known global defaults from the servers.