diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-20 16:16:14 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-20 16:16:14 +0100 |
commit | 3185e5d746abda1b7f42ecdbd74ec14359fda3bc (patch) | |
tree | e74ee3a587d62fdf68f79093af2202188aed3bc5 /lib/mauve/http_server.rb | |
parent | 4ffe222986d4e3565a1f189325d77b33f90dfa15 (diff) | |
parent | d3a3cfef9650b08f62db62bd7e86b673f9d77d0b (diff) |
merge
Diffstat (limited to 'lib/mauve/http_server.rb')
-rw-r--r-- | lib/mauve/http_server.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/mauve/http_server.rb b/lib/mauve/http_server.rb index 71261c8..7bd4467 100644 --- a/lib/mauve/http_server.rb +++ b/lib/mauve/http_server.rb @@ -87,7 +87,7 @@ module Mauve include Singleton - attr_accessor :port, :ip, :document_root + attr_accessor :port, :ip, :document_root, :base_url attr_accessor :session_secret def initialize @@ -96,6 +96,7 @@ module Mauve @ip = "127.0.0.1" @document_root = "/usr/share/mauvealert" @session_secret = "%x" % rand(2**100) + @server_name = nil end def main_loop @@ -105,6 +106,10 @@ module Mauve @server = ::Thin::Server.new(@ip, @port, Rack::Session::Cookie.new(WebInterface.new, {:key => "mauvealert", :secret => @session_secret, :expire_after => 691200}), :signals => false) @server.start end + + def base_url + @base_url ||= "http://"+Server.instance.hostname + end def stop @server.stop if @server |