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

Instance Method Details

#applicationObject

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

#countObject

Get the number of server processes to run.



31
32
33
# File 'lib/lively/environment/application.rb', line 31

def count
  1
end

#middlewareObject

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.expand_path("public", self.root)
    builder.use Lively::Assets, root: File.expand_path("../../../public", __dir__)
    builder.use self.application
  end
end

#urlObject

Get the server URL for this application.



25
26
27
# File 'lib/lively/environment/application.rb', line 25

def url
  "http://localhost:9292"
end