Class: AgileProxy::Server
- Inherits:
-
Object
- Object
- AgileProxy::Server
- 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. '../../', File.dirname(__FILE__)
Instance Attribute Summary collapse
-
#request_handler ⇒ Object
readonly
Returns the value of attribute request_handler.
Instance Method Summary collapse
-
#host ⇒ String
The host that the proxy server is running on.
-
#initialize ⇒ Server
constructor
A new instance of Server.
-
#port ⇒ String
The port that the proxy server is running on.
-
#server_host ⇒ String
The host that the direct server is running on.
-
#server_port ⇒ String
The port that the direct server is running on.
-
#server_url ⇒ String
The url that the direct web server can be accessed from.
-
#start ⇒ Object
Starts the proxy and web servers.
-
#url ⇒ String
The url that the proxy server is running on.
-
#webserver_host ⇒ String
The host that the webserver is running on.
-
#webserver_port ⇒ String
The port that the webserver is running on.
-
#webserver_url ⇒ String
The url that the web server can be accessed from.
Constructor Details
#initialize ⇒ Server
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_handler ⇒ Object (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
#host ⇒ String
The host that the proxy server is running on
70 71 72 |
# File 'lib/agile_proxy/server.rb', line 70 def host 'localhost' end |
#port ⇒ String
The port that the proxy server is running on
76 77 78 |
# File 'lib/agile_proxy/server.rb', line 76 def port @request_spec_server.port end |
#server_host ⇒ String
The host that the direct server is running on
94 95 96 |
# File 'lib/agile_proxy/server.rb', line 94 def server_host AgileProxy.config.server_host end |
#server_port ⇒ String
The port that the direct server is running on
100 101 102 |
# File 'lib/agile_proxy/server.rb', line 100 def server_port AgileProxy.config.server_port end |
#server_url ⇒ String
The url that the direct web server can be accessed from
64 65 66 |
# File 'lib/agile_proxy/server.rb', line 64 def server_url "http://#{server_host}:#{server_port}" end |
#start ⇒ Object
Starts the proxy and web servers
46 47 48 |
# File 'lib/agile_proxy/server.rb', line 46 def start main_loop end |
#url ⇒ String
The url that the proxy server is running on
52 53 54 |
# File 'lib/agile_proxy/server.rb', line 52 def url "http://#{host}:#{port}" end |
#webserver_host ⇒ String
The host that the webserver is running on
82 83 84 |
# File 'lib/agile_proxy/server.rb', line 82 def webserver_host AgileProxy.config.webserver_host end |
#webserver_port ⇒ String
The port that the webserver is running on
88 89 90 |
# File 'lib/agile_proxy/server.rb', line 88 def webserver_port AgileProxy.config.webserver_port end |
#webserver_url ⇒ String
The url that the web server can be accessed from
58 59 60 |
# File 'lib/agile_proxy/server.rb', line 58 def webserver_url "http://#{webserver_host}:#{webserver_port}" end |