Module: Falcon::Environment::Server
- Included in:
- Application, Proxy, Redirect
- Defined in:
- lib/falcon/environment/server.rb
Overview
Provides an environment for hosting a web application that uses a Falcon server.
Instance Method Summary collapse
-
#authority ⇒ Object
The server authority.
-
#cache ⇒ Object
Whether to enable the HTTP cache for this server.
-
#client_endpoint ⇒ Object
A client endpoint that can be used to connect to the server.
-
#container_options ⇒ Object
Options to use when creating the container.
-
#count ⇒ Object
Number of instances to start.
-
#endpoint ⇒ Object
The upstream endpoint that will handle incoming requests.
-
#endpoint_options ⇒ Object
Options to use when creating the endpoint.
-
#make_server(endpoint) ⇒ Object
Make a server instance using the given endpoint.
-
#preload ⇒ Object
Any scripts to preload before starting the server.
-
#service_class ⇒ Object
The service class to use for the proxy.
-
#timeout ⇒ Object
The timeout used for client connections.
-
#url ⇒ Object
The host that this server will receive connections for.
-
#verbose ⇒ Object
Whether to enable verbose logging.
Instance Method Details
#authority ⇒ Object
The server authority. Defaults to the server name.
24 25 26 |
# File 'lib/falcon/environment/server.rb', line 24 def self.name end |
#cache ⇒ Object
Whether to enable the HTTP cache for this server.
73 74 75 |
# File 'lib/falcon/environment/server.rb', line 73 def cache false end |
#client_endpoint ⇒ Object
A client endpoint that can be used to connect to the server.
79 80 81 |
# File 'lib/falcon/environment/server.rb', line 79 def client_endpoint ::Async::HTTP::Endpoint.parse(url) end |
#container_options ⇒ Object
Options to use when creating the container.
35 36 37 38 39 40 41 |
# File 'lib/falcon/environment/server.rb', line 35 def { restart: true, count: self.count, health_check_timeout: 30, }.compact end |
#count ⇒ Object
Number of instances to start. By default (when nil), uses ‘Etc.nprocessors`.
30 31 32 |
# File 'lib/falcon/environment/server.rb', line 30 def count nil end |
#endpoint ⇒ Object
The upstream endpoint that will handle incoming requests.
63 64 65 |
# File 'lib/falcon/environment/server.rb', line 63 def endpoint ::Async::HTTP::Endpoint.parse(url).with(**) end |
#endpoint_options ⇒ Object
Options to use when creating the endpoint.
54 55 56 57 58 59 |
# File 'lib/falcon/environment/server.rb', line 54 def { reuse_address: true, timeout: self.timeout, } end |
#make_server(endpoint) ⇒ Object
Make a server instance using the given endpoint. The endpoint may be a bound endpoint, so we take care to specify the protocol and scheme as per the original endpoint.
94 95 96 |
# File 'lib/falcon/environment/server.rb', line 94 def make_server(endpoint) Falcon::Server.new(self.middleware, endpoint, protocol: self.endpoint.protocol, scheme: self.endpoint.scheme) end |
#preload ⇒ Object
Any scripts to preload before starting the server.
86 87 88 |
# File 'lib/falcon/environment/server.rb', line 86 def preload [] end |
#service_class ⇒ Object
The service class to use for the proxy.
18 19 20 |
# File 'lib/falcon/environment/server.rb', line 18 def service_class Service::Server end |
#timeout ⇒ Object
The timeout used for client connections.
49 50 51 |
# File 'lib/falcon/environment/server.rb', line 49 def timeout nil end |
#url ⇒ Object
The host that this server will receive connections for.
44 45 46 |
# File 'lib/falcon/environment/server.rb', line 44 def url "http://[::]:9292" end |
#verbose ⇒ Object
Whether to enable verbose logging.
68 69 70 |
# File 'lib/falcon/environment/server.rb', line 68 def verbose false end |