def prepare_configuration
if @options.has_key? :status_path
unless File.exist? @options[:status_path]
raise "Status file not found: #{@options[:status_path]}"
end
status = YAML.load File.read(@options[:status_path])
if status.kind_of?(Hash) && status.has_key?("config")
conf = status["config"]
if url = conf.options[:control_url]
@options[:control_url] = url
end
if token = conf.options[:control_auth_token]
@options[:control_auth_token] = token
end
@options[:pid] = status["pid"].to_i
else
raise "Invalid status file: #{@options[:status_path]}"
end
elsif @options.has_key? :pid_file
@options[:pid] = File.open(@options[:pid_file]).gets.to_i
end
end