Module: Lively::Environment::Application
- Includes:
- Falcon::Environment::Server
- Defined in:
- lib/lively/environment/application.rb
Overview
Represents the environment configuration for a Lively application server.
This module provides server configuration including URL binding, process count, application class resolution, and middleware stack setup. It integrates with Falcon’s server environment to provide a complete hosting solution.
Instance Method Summary collapse
-
#application ⇒ Object
Resolve the application class to use.
-
#count ⇒ Object
Get the number of server processes to run.
-
#middleware ⇒ Object
Build the middleware stack for this application.
-
#url ⇒ Object
Get the server URL for this application.
Instance Method Details
#application ⇒ Object
Resolve the application class to use.
37 38 39 40 41 42 43 44 |
# File 'lib/lively/environment/application.rb', line 37 def application if Object.const_defined?(:Application) Object.const_get(:Application) else Console.warn(self, "No Application class defined, using default.") ::Lively::Application end end |
#count ⇒ Object
Get the number of server processes to run.
31 32 33 |
# File 'lib/lively/environment/application.rb', line 31 def count 1 end |
#middleware ⇒ Object
Build the middleware stack for this application.
48 49 50 51 52 53 54 |
# File 'lib/lively/environment/application.rb', line 48 def middleware ::Protocol::HTTP::Middleware.build do |builder| builder.use Lively::Assets, root: File.("public", self.root) builder.use Lively::Assets, root: File.("../../../public", __dir__) builder.use self.application end end |
#url ⇒ Object
Get the server URL for this application.
25 26 27 |
# File 'lib/lively/environment/application.rb', line 25 def url "http://localhost:9292" end |