def configure(options, cfg)
      cfg[:root_dir]           = AgentConfig.root_dir
      cfg[:pid_dir]            = AgentConfig.pid_dir
      cfg[:identity]           = options[:identity] if options[:identity]
      cfg[:token]              = options[:token] if options[:token]
      cfg[:api_url]            = options[:api_url] if options[:api_url]
      cfg[:account_id]         = options[:account_id] if options[:account_id]
      cfg[:shard_id]           = options[:shard_id] if options[:shard_id]
      cfg[:mode]               = options[:mode] if options[:mode]
      cfg[:user]               = options[:user] if options[:user]
      cfg[:pass]               = options[:pass] if options[:pass]
      cfg[:vhost]              = options[:vhost] if options[:vhost]
      cfg[:port]               = options[:port] if options[:port]
      cfg[:host]               = options[:host] if options[:host]
      cfg[:prefetch]           = options[:prefetch] || 1
      cfg[:heartbeat]          = options[:heartbeat] if options[:heartbeat]
      cfg[:time_to_live]       = options[:time_to_live] || 60
      cfg[:retry_timeout]      = options[:retry_timeout] || 60
      cfg[:retry_interval]     = options[:retry_interval] || 5
      cfg[:ping_interval]      = options[:ping_interval] ||= 4 * 60 * 60
      cfg[:check_interval]     = options[:check_interval] if options[:check_interval]
      cfg[:reconnect_interval] = options[:reconnect_interval] if options[:reconnect_interval]
      cfg[:grace_timeout]      = options[:grace_timeout] if options[:grace_timeout]
      cfg[:dup_check]          = options[:dup_check].nil? ? true : options[:dup_check]
      cfg[:http_proxy]         = options[:http_proxy] if options[:http_proxy]
      cfg[:http_no_proxy]      = options[:http_no_proxy] if options[:http_no_proxy]
      cfg[:fiber_pool_size]    = options[:fiber_pool_size] if options[:fiber_pool_size]
      cfg[:airbrake_endpoint]  = options[:airbrake_endpoint] if options[:airbrake_endpoint]
      cfg[:airbrake_api_key]   = options[:airbrake_api_key] if options[:airbrake_api_key]
      cfg
    end
def configure(options, cfg)
      cfg[:root_dir]           = AgentConfig.root_dir
      cfg[:pid_dir]            = AgentConfig.pid_dir
      cfg[:identity]           = options[:identity] if options[:identity]
      cfg[:token]              = options[:token] if options[:token]
      cfg[:api_url]            = options[:api_url] if options[:api_url]
      cfg[:account_id]         = options[:account_id] if options[:account_id]
      cfg[:shard_id]           = options[:shard_id] if options[:shard_id]
      cfg[:mode]               = options[:mode] if options[:mode]
      cfg[:user]               = options[:user] if options[:user]
      cfg[:pass]               = options[:pass] if options[:pass]
      cfg[:vhost]              = options[:vhost] if options[:vhost]
      cfg[:port]               = options[:port] if options[:port]
      cfg[:host]               = options[:host] if options[:host]
      cfg[:prefetch]           = options[:prefetch] || 1
      cfg[:heartbeat]          = options[:heartbeat] if options[:heartbeat]
      cfg[:time_to_live]       = options[:time_to_live] || 60
      cfg[:retry_timeout]      = options[:retry_timeout] || 60
      cfg[:retry_interval]     = options[:retry_interval] || 5
      cfg[:ping_interval]      = options[:ping_interval] ||= 4 * 60 * 60
      cfg[:check_interval]     = options[:check_interval] if options[:check_interval]
      cfg[:reconnect_interval] = options[:reconnect_interval] if options[:reconnect_interval]
      cfg[:grace_timeout]      = options[:grace_timeout] if options[:grace_timeout]
      cfg[:dup_check]          = options[:dup_check].nil? ? true : options[:dup_check]
      cfg[:http_proxy]         = options[:http_proxy] if options[:http_proxy]
      cfg[:http_no_proxy]      = options[:http_no_proxy] if options[:http_no_proxy]
      cfg[:fiber_pool_size]    = options[:fiber_pool_size] if options[:fiber_pool_size]
      cfg[:airbrake_endpoint]  = options[:airbrake_endpoint] if options[:airbrake_endpoint]
      cfg[:airbrake_api_key]   = options[:airbrake_api_key] if options[:airbrake_api_key]
      cfg
    end
Determine configuration settings to be persisted

 === Parameters
 options(Hash):: Command line options
 cfg(Hash):: Initial configuration settings

 === Return
 cfg(Hash):: Configuration settings