code: func (a *Agent) applyProxyDefaults(proxy *structs.ConnectManagedProxy) error {
  	// Set the default exec mode
  	if proxy.ExecMode == structs.ProxyExecModeUnspecified {
  		mode, err := structs.NewProxyExecMode(a.config.ConnectProxyDefaultExecMode)
  		if err != nil {
  			return err
  		}
  
  		proxy.ExecMode = mode
  	}
  	if proxy.ExecMode == structs.ProxyExecModeUnspecified {
  		proxy.ExecMode = structs.ProxyExecModeDaemon
  	}
  
  	// Set the default command to the globally configured default
  	if len(proxy.Command) == 0 {
  		switch proxy.ExecMode {
  		case structs.ProxyExecModeDaemon:
  			proxy.Command = a.config.ConnectProxyDefaultDaemonCommand
  
  		case structs.ProxyExecModeScript:
  			proxy.Command = a.config.ConnectProxyDefaultScriptCommand
  		}
  	}
  
  	// If there is no globally configured default we need to get the
  	// default command so we can do "consul connect proxy"
  	if len(proxy.Command) == 0 {
  		command, err := defaultProxyCommand(a.config)
  		if err != nil {
  			return err
  		}
  
  		proxy.Command = command
  	}
  
  	return nil
  }
docs: // applyProxyDefaults modifies the given proxy by applying any configured
  // defaults, such as the default execution mode, command, etc.