func New()

in internal/config/config.go [135:178]


func New(cfg *config.C) (*Config, error) {
	c, err := defaultConfig()
	if err != nil {
		return nil, err
	}

	if err := cfg.Unpack(&c); err != nil {
		return nil, err
	}

	if c.Benchmark != "" {
		if !isSupportedBenchmark(c.Benchmark) {
			return c, launcher.NewUnhealthyError(fmt.Sprintf("benchmark '%s' is not supported", c.Benchmark))
		}
	}

	switch c.CloudConfig.Aws.AccountType {
	case "":
	case SingleAccount:
	case OrganizationAccount:
	default:
		return nil, launcher.NewUnhealthyError(fmt.Sprintf(
			"aws.account_type '%s' is not supported",
			c.CloudConfig.Aws.AccountType,
		))
	}

	switch c.CloudConfig.Azure.AccountType {
	case "":
	case SingleAccount:
	case OrganizationAccount:
	default:
		return nil, launcher.NewUnhealthyError(fmt.Sprintf(
			"azure.account_type '%s' is not supported",
			c.CloudConfig.Azure.AccountType,
		))
	}

	if c.CloudConfig.Aws.CloudConnectors {
		c.CloudConfig.Aws.CloudConnectorsConfig = newCloudConnectorsConfig()
	}

	return c, nil
}