Class: AgileProxy::Server

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/agile_proxy/server.rb

Overview

This class is responsible for controlling the underlying proxy and web servers

Constant Summary collapse

ROOT =
File.expand_path '../../', File.dirname(__FILE__)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



38
39
40
41
42
43
# File 'lib/agile_proxy/server.rb', line 38

def initialize
  environment = AgileProxy.config.environment
  dbconfig    = YAML.load(File.read(AgileProxy.config.database_config_file)).with_indifferent_access
  ActiveRecord::Base.configurations = dbconfig
  ActiveRecord::Base.establish_connection dbconfig[environment.to_s]
end

Instance Attribute Details

#request_handlerObject (readonly)

Returns the value of attribute request_handler.



34
35
36
# File 'lib/agile_proxy/server.rb', line 34

def request_handler
  @request_handler
end

Instance Method Details

#hostString

The host that the proxy server is running on

Returns:

  • (String)

    The host



70
71
72
# File 'lib/agile_proxy/server.rb', line 70

def host
  'localhost'
end

#portString

The port that the proxy server is running on

Returns:

  • (String)

    The port



76
77
78
# File 'lib/agile_proxy/server.rb', line 76

def port
  @request_spec_server.port
end

#server_hostString

The host that the direct server is running on

Returns:

  • (String)

    The host



94
95
96
# File 'lib/agile_proxy/server.rb', line 94

def server_host
  AgileProxy.config.server_host
end

#server_portString

The port that the direct server is running on

Returns:

  • (String)

    The port



100
101
102
# File 'lib/agile_proxy/server.rb', line 100

def server_port
  AgileProxy.config.server_port
end

#server_urlString

The url that the direct web server can be accessed from

Returns:

  • (String)

    The URL



64
65
66
# File 'lib/agile_proxy/server.rb', line 64

def server_url
  "http://#{server_host}:#{server_port}"
end

#startObject

Starts the proxy and web servers



46
47
48
# File 'lib/agile_proxy/server.rb', line 46

def start
  main_loop
end

#urlString

The url that the proxy server is running on

Returns:

  • (String)

    The URL



52
53
54
# File 'lib/agile_proxy/server.rb', line 52

def url
  "http://#{host}:#{port}"
end

#webserver_hostString

The host that the webserver is running on

Returns:

  • (String)

    The host



82
83
84
# File 'lib/agile_proxy/server.rb', line 82

def webserver_host
  AgileProxy.config.webserver_host
end

#webserver_portString

The port that the webserver is running on

Returns:

  • (String)

    The port



88
89
90
# File 'lib/agile_proxy/server.rb', line 88

def webserver_port
  AgileProxy.config.webserver_port
end

#webserver_urlString

The url that the web server can be accessed from

Returns:

  • (String)

    The URL



58
59
60
# File 'lib/agile_proxy/server.rb', line 58

def webserver_url
  "http://#{webserver_host}:#{webserver_port}"
end