   parsed = parse str
   return loadConfig parsed
 
-validateConfig = (str, options) ->
+validateConfigObject = (parsed, options) ->
   tv4 = require 'tv4'
   tv4.addSchema schemas.roleconfig.id, schemas.roleconfig
   tv4.addSchema schemas.config.id, schemas.config
-  parsed = parse str
 
   options.allowKeys = [] if not options.allowKeys
 

main() if not module.parent

exports.validate = validateConfig
exports.parse = parseConfig
exports.parseOnly = parse
exports.load = loadConfig

    errors.push err

  return errors

validateConfig = (str, options) ->
  parsed = parse str
  return validateConfigObject parsed, options

estimateRates = (cfg) ->
  rates = {}
