Class: Vines::Config::HttpPort

Inherits:
Port
  • Object
show all
Defined in:
lib/vines/config/port.rb

Instance Attribute Summary

Attributes inherited from Port

#config, #settings, #stream

Instance Method Summary collapse

Methods inherited from Port

#max_stanza_size

Methods included from Log

#log

Constructor Details

#initialize(config, host = '0.0.0.0', port = 5280, &block) ⇒ HttpPort

Returns a new instance of HttpPort.



77
78
79
80
81
82
# File 'lib/vines/config/port.rb', line 77

def initialize(config, host='0.0.0.0', port=5280, &block)
  @stream = Vines::Stream::Http
  super(config, host, port, &block)
  defaults = {:root => File.expand_path('web'), :bind => '/xmpp'}
  @settings = defaults.merge(@settings)
end

Instance Method Details

#bind(url = nil) ⇒ Object



100
101
102
103
104
105
106
# File 'lib/vines/config/port.rb', line 100

def bind(url=nil)
  if url
    @settings[:bind] = url
  else
    @settings[:bind]
  end
end

#max_resources_per_account(max = nil) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/vines/config/port.rb', line 84

def (max=nil)
  if max
    @settings[:max_resources_per_account] = max
  else
    @settings[:max_resources_per_account]
  end
end

#root(dir = nil) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/vines/config/port.rb', line 92

def root(dir=nil)
  if dir
    @settings[:root] = File.expand_path(dir)
  else
    @settings[:root]
  end
end

#startObject



117
118
119
120
121
122
# File 'lib/vines/config/port.rb', line 117

def start
  super
  if config.cluster? && vroute.nil?
    log.warn("vroute sticky session cookie not set")
  end
end

#vroute(id = nil) ⇒ Object



108
109
110
111
112
113
114
115
# File 'lib/vines/config/port.rb', line 108

def vroute(id=nil)
  if id
    id = id.to_s.strip
    @settings[:vroute] = id.empty? ? nil : id
  else
    @settings[:vroute]
  end
end