From 699edba963f79195496e20d3490c21d599940c2e Mon Sep 17 00:00:00 2001 From: Samuel Cochran Date: Mon, 25 Oct 2010 09:23:19 +0800 Subject: [PATCH] Options, be good to me --- lib/mail_catcher.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/mail_catcher.rb b/lib/mail_catcher.rb index 0b0e62d..014fc87 100644 --- a/lib/mail_catcher.rb +++ b/lib/mail_catcher.rb @@ -199,11 +199,16 @@ module MailCatcher end end - def self.run + def self.run(options = {}) + options[:smtp_ip] ||= '127.0.0.1' + options[:smtp_port] ||= 1025 + options[:http_ip] ||= '127.0.0.1' + options[:http_port] ||= 1080 + Thin::Logging.silent = true EM::run do - EM::start_server '127.0.0.1', 1025, SmtpServer - Thin::Server.start WebApp, '127.0.0.1', 1080 + EM::start_server options[:smtp_ip], options[:smtp_port], SmtpServer + Thin::Server.start WebApp, options[:http_ip], options[:http_port] end end end