Falcon SourceFalconEnvironmentServer

module Server

Provides an environment for hosting a web application that uses a Falcon server.

Definitions

def service_class

The service class to use for the proxy.

Signature

returns Class

Implementation

def service_class
	Service::Server
end

def authority

The server authority. Defaults to the server name.

Signature

returns String

Implementation

def authority
	self.name
end

def count

Number of instances to start. By default (when nil), uses Etc.nprocessors.

Signature

returns Integer | nil

Implementation

def count
	nil
end

def container_options

Options to use when creating the container.

Implementation

def container_options
	{restart: true, count: self.count}.compact
end

def url

The host that this server will receive connections for.

Implementation

def url
	"http://[::]:9292"
end

def endpoint

The upstream endpoint that will handle incoming requests.

Signature

returns Async::HTTP::Endpoint

Implementation

def endpoint
	::Async::HTTP::Endpoint.parse(url).with(
		reuse_address: true,
		timeout: timeout,
	)
end

def preload

Any scripts to preload before starting the server.

Implementation

def preload
	[]
end