Class: Vines::Config::HttpPort

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

Instance Attribute Summary

Attributes inherited from Port

#config, #stream

Instance Method Summary collapse

Methods inherited from Port

#max_stanza_size, #start

Methods included from Log

#log

Constructor Details

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

Returns a new instance of HttpPort.



174
175
176
177
178
179
# File 'lib/vines/config.rb', line 174

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



205
206
207
208
209
210
211
# File 'lib/vines/config.rb', line 205

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

#max_resources_per_account(max = nil) ⇒ Object



181
182
183
184
185
186
187
# File 'lib/vines/config.rb', line 181

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

#private_storage(enabled) ⇒ Object



189
190
191
# File 'lib/vines/config.rb', line 189

def private_storage(enabled)
  @settings[:private_storage] = !!enabled
end

#private_storage?Boolean

Returns:

  • (Boolean)


193
194
195
# File 'lib/vines/config.rb', line 193

def private_storage?
  @settings[:private_storage]
end

#root(dir = nil) ⇒ Object



197
198
199
200
201
202
203
# File 'lib/vines/config.rb', line 197

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