code: func NewConfig(ec2client ec2.EC2MetadataClient) (*Config, error) {
  	var errs []error
  	envConfig, err := environmentConfig() //Environment overrides all else
  	if err != nil {
  		errs = append(errs, err)
  	}
  	config := &envConfig
  
  	if config.complete() {
  		// No need to do file / network IO
  		return config, nil
  	}
  
  	fcfg, err := fileConfig()
  	if err != nil {
  		errs = append(errs, err)
  	}
  	config.Merge(fcfg)
  
  	config.Merge(userDataConfig(ec2client))
  
  	if config.AWSRegion == "" {
  		if config.NoIID {
  			// get it from AWS SDK if we don't have instance identity document
  			awsRegion, err := ec2client.Region()
  			if err != nil {
  				errs = append(errs, err)
  			}
  			config.AWSRegion = awsRegion
  		} else {
  			// Get it from metadata only if we need to (network io)
  			config.Merge(ec2MetadataConfig(ec2client))
  		}
  	}
  
  	return config, config.mergeDefaultConfig(errs)
  }
docs: // NewConfig returns a config struct created by merging environment variables,
  // a config file, and EC2 Metadata info.
  // The 'config' struct it returns can be used, even if an error is returned. An
  // error is returned, however, if the config is incomplete in some way that is
  // considered fatal.