def initialize(options)
@options = DEFAULT_OPTIONS.clone.merge(options)
root = options[:root] || @options[:root]
custom_config = if root
file = File.expand_path(File.join(root, 'config.yml'))
File.exists?(file) ? (YAML.load(IO.read(file)) || {}) : {}
else
{}
end
options.delete(:identity) unless options[:identity]
@options.update(custom_config.merge(options))
@identity = "mapper-#{@options[:identity]}"
@options[:file_root] ||= File.join(@options[:root], 'files')
@options[:log_path] = false
if @options[:daemonize]
@options[:log_path] = (@options[:log_dir] || @options[:root] || Dir.pwd)
end
@options.freeze
@offline_queue = 'mapper-offline'
end