lib/nephos-server/server/main.rb in nephos-server-0.4.5 vs lib/nephos-server/server/main.rb in nephos-server-0.4.6
- old
+ new
@@ -3,24 +3,25 @@
module Nephos
class Server
SERVER = lambda {|env| return Router.execute(env)}
- attr_accessor :port
+ attr_accessor :port, :host
# @param port [Integer] port to listen
- def initialize port
+ def initialize port="8080", host="0.0.0.0"
@port = Integer(port)
+ @host = host.to_s
end
# start the Rack server
def start
- Rack::Server.start :app => SERVER, :Port => @port
+ Rack::Server.start :app => SERVER, :Port => @port, :Host => @host
end
# start the Rack server on a instance of Nephos::Server
- def self.start port
- Server.new(port).start
+ def self.start port, host
+ Server.new(port, host).start
end
end
end