Sha256: f380bfd26ca0ccbdd636da1419febf72865d3c820c3063d9a696779f5b891116
Contents?: true
Size: 709 Bytes
Versions: 6
Compression:
Stored size: 709 Bytes
Contents
require 'yaml' require 'json' module Vcloud class ConfigLoader def load_config(config_file, schema = nil) input_config = YAML::load(File.open(config_file)) # There is no way in YAML or Ruby to symbolize keys in a hash json_string = JSON.generate(input_config) config = JSON.parse(json_string, :symbolize_names => true) if schema validation = ConfigValidator.validate(:base, config, schema) unless validation.valid? validation.errors.each do |error| Vcloud::EdgeGateway.logger.fatal(error) end raise("Supplied configuration does not match supplied schema") end end config end end end
Version data entries
6 entries across 6 versions & 1 rubygems