func ConfigValidation()

in pkg/cfg/cfg.go [310:333]


func ConfigValidation(configPath string) {
	validConfigArray := validConfigArray()
	userConfigArray := userConfigArray(configPath)

	notSupportFlag := []string{"Profile.CPU", "Profile.Memory", "Socket.BufferSizeKB", "Logging.LogFormat", "Processor.BatchProcessorQueueSize"}
	needMigrateFlag := []string{"LogRotation", "Processor.Region", "Processor.Endpoint", "Processor.Routine", "MemoryLimit"}
	for i := 0; i < len(userConfigArray); i++ {
		if !contains(userConfigArray, "Version") {
			errorAndExit("Config Version is missing. Use X-Ray Daemon Config Migration Script to update the config file. Please refer to AWS X-Ray Documentation for more information.", nil)
		}
		if !contains(validConfigArray, userConfigArray[i]) {
			if contains(notSupportFlag, userConfigArray[i]) {
				errorMessage := fmt.Sprintf("%v flag is not supported any more. Please refer to AWS X-Ray Documentation for more information.", userConfigArray[i])
				errorAndExit(errorMessage, nil)
			} else if contains(needMigrateFlag, userConfigArray[i]) {
				errorMessage := fmt.Sprintf("%v flag is not supported. Use X-Ray Daemon Config Migration Script to update the config file. Please refer to AWS X-Ray Documentation for more information.", userConfigArray[i])
				errorAndExit(errorMessage, nil)
			} else {
				errorMessage := fmt.Sprintf("%v flag is invalid. Please refer to AWS X-Ray Documentation for more information.", userConfigArray[i])
				errorAndExit(errorMessage, nil)
			}
		}
	}
}