falcon 0.54.3 → 0.55.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/context/deployment.md +5 -5
  4. data/lib/falcon/body/request_finished.rb +61 -0
  5. data/lib/falcon/command/host.rb +2 -2
  6. data/lib/falcon/command/paths.rb +3 -3
  7. data/lib/falcon/command/proxy.rb +8 -3
  8. data/lib/falcon/command/redirect.rb +11 -3
  9. data/lib/falcon/command/serve.rb +14 -4
  10. data/lib/falcon/command/top.rb +2 -2
  11. data/lib/falcon/command/virtual.rb +6 -2
  12. data/lib/falcon/command.rb +2 -1
  13. data/lib/falcon/composite_server.rb +1 -1
  14. data/lib/falcon/environment/configured.rb +4 -2
  15. data/lib/falcon/environment/lets_encrypt_tls.rb +1 -3
  16. data/lib/falcon/environment/proxy.rb +6 -11
  17. data/lib/falcon/environment/rack.rb +1 -3
  18. data/lib/falcon/environment/rackup.rb +7 -1
  19. data/lib/falcon/environment/redirect.rb +8 -2
  20. data/lib/falcon/environment/self_signed_tls.rb +1 -3
  21. data/lib/falcon/environment/server.rb +2 -2
  22. data/lib/falcon/environment/tls.rb +1 -2
  23. data/lib/falcon/environment/virtual.rb +4 -1
  24. data/lib/falcon/environment.rb +1 -4
  25. data/lib/falcon/middleware/proxy.rb +6 -1
  26. data/lib/falcon/middleware/redirect.rb +5 -1
  27. data/lib/falcon/proxy_endpoint.rb +3 -1
  28. data/lib/falcon/rackup/handler.rb +7 -1
  29. data/lib/falcon/railtie.rb +2 -1
  30. data/lib/falcon/server.rb +30 -23
  31. data/lib/falcon/service/server.rb +6 -3
  32. data/lib/falcon/tls.rb +2 -1
  33. data/lib/falcon/version.rb +3 -2
  34. data/lib/falcon.rb +1 -1
  35. data/lib/rack/handler/falcon.rb +3 -1
  36. data/lib/rackup/handler/falcon.rb +3 -1
  37. data/license.md +1 -1
  38. data/readme.md +11 -10
  39. data/releases.md +11 -0
  40. data.tar.gz.sig +0 -0
  41. metadata +15 -17
  42. metadata.gz.sig +0 -0
  43. data/bake/falcon/supervisor.rb +0 -8
  44. data/lib/falcon/configuration.rb +0 -90
  45. data/lib/falcon/environment/supervisor.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22b09155428d4918e4f5b81cc0b809a8ca678f2509fbfb42f7e67cb2621d74dc
4
- data.tar.gz: df9bbb12499685689dd38a38ede8807f5f09022394c13386766a178bc0760962
3
+ metadata.gz: 45c36302281a4c7947bc8c19869f93143254e821c0ab327b725aa8782dd710cb
4
+ data.tar.gz: c59ab82cc9babe0eea1a7ec74b2fdba4be6801dd7b1b05359fec6a2f8ec0db91
5
5
  SHA512:
6
- metadata.gz: 8a483823b106bf170b158c70f797e3cbb1a233fc74b7be20d7deed8d8d0b690b1f5945330a64b9c5245978759f91fee7b14b1dbf35ede89021a0c6e902a652f2
7
- data.tar.gz: 4707fbfbbe508fa06e32815c6ed5e0ba3d6ebc279af9f1460a9be633e86aecc8a05b49919f885ff848c50cd3bc2d8b058671622c44b7b95ee4119c91f1746155
6
+ metadata.gz: 2242015bc8980ebef3ae53fb2bf8db8040ef943bada60bb801cd65e849cfc68f8586b6a33e050053270cd9bd10ea9e5c778de117adb82353ecc47d24439bfb7f
7
+ data.tar.gz: 522154fa107e97fa4a8b72e997f71ab7afcf4e8a5699cb741f6d16aa2720b722a664dae052c82130df930af3430aa1d531a705ac59081658074008b4e58ded6a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -24,7 +24,7 @@ Here is a basic example which hosts a rack application:
24
24
 
25
25
  require "falcon/environment/rack"
26
26
  require "falcon/environment/lets_encrypt_tls"
27
- require "falcon/environment/supervisor"
27
+ require "async/service/supervisor"
28
28
 
29
29
  hostname = File.basename(__dir__)
30
30
  service hostname do
@@ -35,11 +35,11 @@ service hostname do
35
35
  cache true
36
36
 
37
37
  # Connect to the supervisor for monitoring.
38
- include Async::Container::Supervisor::Supervised
38
+ include Async::Service::Supervisor::Supervised
39
39
  end
40
40
 
41
41
  service "supervisor" do
42
- include Falcon::Environment::Supervisor
42
+ include Async::Service::Supervisor::Environment
43
43
 
44
44
  monitors do
45
45
  [
@@ -71,7 +71,7 @@ The environment configuration is defined in the `Falcon::Environment` module. Th
71
71
  # frozen_string_literal: true
72
72
 
73
73
  require "falcon/environment/rack"
74
- require "falcon/environment/supervisor"
74
+ require "async/service/supervisor"
75
75
 
76
76
  hostname = File.basename(__dir__)
77
77
  service hostname do
@@ -86,7 +86,7 @@ service hostname do
86
86
  end
87
87
 
88
88
  service "supervisor" do
89
- include Falcon::Environment::Supervisor
89
+ include Async::Service::Supervisor::Environment
90
90
  end
91
91
  ~~~
92
92
 
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2025, by Samuel Williams.
5
+
6
+ require "protocol/http/body/wrapper"
7
+
8
+ module Falcon
9
+ # @namespace
10
+ module Body
11
+ # Wraps a response body and decrements a metric after the body is closed.
12
+ #
13
+ # Runs close on the underlying body first (which invokes rack.response_finished),
14
+ # then decrements the metric. Use this so requests_active stays elevated until
15
+ # the request is fully finished (including response_finished callbacks).
16
+ class RequestFinished < Protocol::HTTP::Body::Wrapper
17
+ # Wrap a response body with a metric. If the body is nil or empty, decrements immediately.
18
+ #
19
+ # @parameter message [Protocol::HTTP::Response] The response whose body to wrap.
20
+ # @parameter metric [Async::Utilization::Metric] The metric to decrement when the body is closed.
21
+ # @returns [Protocol::HTTP::Response] The message (modified in place).
22
+ def self.wrap(message, metric)
23
+ if body = message&.body and !body.empty?
24
+ message.body = new(body, metric)
25
+ else
26
+ metric.decrement
27
+ end
28
+
29
+ message
30
+ end
31
+
32
+ # @parameter body [Protocol::HTTP::Body::Readable] The body to wrap.
33
+ # @parameter metric [Async::Utilization::Metric] The metric to decrement on close.
34
+ def initialize(body, metric)
35
+ super(body)
36
+
37
+ @metric = metric
38
+ end
39
+
40
+ # @returns [Boolean] False, the wrapper does not support rewinding.
41
+ def rewindable?
42
+ false
43
+ end
44
+
45
+ # @returns [Boolean] False, rewinding is not supported.
46
+ def rewind
47
+ false
48
+ end
49
+
50
+ # Closes the underlying body (invoking rack.response_finished), then decrements the metric.
51
+ #
52
+ # @parameter error [Exception, nil] Optional error that caused the close.
53
+ def close(error = nil)
54
+ super
55
+
56
+ @metric&.decrement
57
+ @metric = nil
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2024, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "paths"
7
7
  require_relative "../version"
@@ -31,7 +31,7 @@ module Falcon
31
31
 
32
32
  # Prepare the environment and run the controller.
33
33
  def call
34
- Console.logger.info(self) do |buffer|
34
+ Console.info(self) do |buffer|
35
35
  buffer.puts "Falcon Host v#{VERSION} taking flight!"
36
36
  buffer.puts "- Configuration: #{@paths.join(', ')}"
37
37
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
- require_relative "../configuration"
6
+ require "async/service/configuration"
7
7
 
8
8
  module Falcon
9
9
  module Command
@@ -21,7 +21,7 @@ module Falcon
21
21
 
22
22
  # Build a configuration based on the resolved paths.
23
23
  def configuration
24
- configuration = Configuration.new
24
+ configuration = Async::Service::Configuration.new
25
25
 
26
26
  self.resolved_paths do |path|
27
27
  path = File.expand_path(path)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "../environment/proxy"
7
7
  require_relative "paths"
@@ -31,6 +31,9 @@ module Falcon
31
31
 
32
32
  include Paths
33
33
 
34
+ # Create the environment for the proxy service.
35
+ # @parameter options [Hash] Additional options to pass to the environment.
36
+ # @returns [Async::Service::Environment] The configured proxy environment.
34
37
  def environment(**options)
35
38
  Async::Service::Environment.new(Falcon::Environment::Proxy).with(
36
39
  root: Dir.pwd,
@@ -42,15 +45,17 @@ module Falcon
42
45
  )
43
46
  end
44
47
 
48
+ # Build the service configuration for the proxy.
49
+ # @returns [Async::Service::Configuration] The service configuration.
45
50
  def configuration
46
- Configuration.for(
51
+ Async::Service::Configuration.for(
47
52
  self.environment(environments: super.environments)
48
53
  )
49
54
  end
50
55
 
51
56
  # Prepare the environment and run the controller.
52
57
  def call
53
- Console.logger.info(self) do |buffer|
58
+ Console.info(self) do |buffer|
54
59
  buffer.puts "Falcon Proxy v#{VERSION} taking flight!"
55
60
  buffer.puts "- Binding to: #{@options[:bind]}"
56
61
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "../environment/redirect"
7
7
  require_relative "paths"
@@ -10,6 +10,9 @@ require "samovar"
10
10
 
11
11
  module Falcon
12
12
  module Command
13
+ # Implements the `falcon redirect` command.
14
+ #
15
+ # Manages a {Controller::Redirect} instance which redirects insecure HTTP traffic to secure HTTPS endpoints.
13
16
  class Redirect < Samovar::Command
14
17
  self.description = "Redirect from insecure HTTP to secure HTTP."
15
18
 
@@ -29,6 +32,9 @@ module Falcon
29
32
 
30
33
  include Paths
31
34
 
35
+ # Create the environment for the redirect service.
36
+ # @parameter options [Hash] Additional options to pass to the environment.
37
+ # @returns [Async::Service::Environment] The configured redirect environment.
32
38
  def environment(**options)
33
39
  Async::Service::Environment.new(Falcon::Environment::Redirect).with(
34
40
  root: Dir.pwd,
@@ -41,15 +47,17 @@ module Falcon
41
47
  )
42
48
  end
43
49
 
50
+ # Build the service configuration for the redirect.
51
+ # @returns [Async::Service::Configuration] The service configuration.
44
52
  def configuration
45
- Configuration.for(
53
+ Async::Service::Configuration.for(
46
54
  self.environment(environments: super.environments)
47
55
  )
48
56
  end
49
57
 
50
58
  # Prepare the environment and run the controller.
51
59
  def call
52
- Console.logger.info(self) do |buffer|
60
+ Console.info(self) do |buffer|
53
61
  buffer.puts "Falcon Redirect v#{VERSION} taking flight!"
54
62
  buffer.puts "- Binding to: #{@options[:bind]}"
55
63
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
  # Copyright, 2018, by Mitsutaka Mimura.
6
6
 
7
7
  require_relative "../server"
8
8
  require_relative "../endpoint"
9
- require_relative "../configuration"
10
9
  require_relative "../service/server"
11
10
  require_relative "../environment/rackup"
12
11
 
12
+ require "async/service/configuration"
13
13
  require "async/container"
14
14
  require "async/http/client"
15
15
  require "samovar"
@@ -49,18 +49,26 @@ module Falcon
49
49
  option "--health-check-timeout <duration>", "Duration to wait for health check.", type: Float, default: 30.0
50
50
  end
51
51
 
52
+ # Extract container-related options from the command line options.
53
+ # @returns [Hash] Options for container configuration.
52
54
  def container_options
53
55
  @options.slice(:count, :forks, :threads, :restart, :health_check_timeout)
54
56
  end
55
57
 
58
+ # Extract endpoint-related options from the command line options.
59
+ # @returns [Hash] Options for endpoint configuration.
56
60
  def endpoint_options
57
61
  @options.slice(:hostname, :port, :timeout)
58
62
  end
59
63
 
64
+ # Get the name for the service, using hostname if available, otherwise the bind address.
65
+ # @returns [String] The service name.
60
66
  def name
61
67
  @options[:hostname] || @options[:bind]
62
68
  end
63
69
 
70
+ # Create the environment for the serve command.
71
+ # @returns [Async::Service::Environment] The configured server environment.
64
72
  def environment
65
73
  Async::Service::Environment.new(Falcon::Environment::Server).with(
66
74
  Falcon::Environment::Rackup,
@@ -82,8 +90,10 @@ module Falcon
82
90
  )
83
91
  end
84
92
 
93
+ # Build the service configuration for the serve command.
94
+ # @returns [Async::Service::Configuration] The service configuration.
85
95
  def configuration
86
- Configuration.new.tap do |configuration|
96
+ Async::Service::Configuration.new.tap do |configuration|
87
97
  configuration.add(self.environment)
88
98
  end
89
99
  end
@@ -117,7 +127,7 @@ module Falcon
117
127
 
118
128
  # Prepare the environment and run the controller.
119
129
  def call
120
- Console.logger.info(self) do |buffer|
130
+ Console.info(self) do |buffer|
121
131
  buffer.puts "Falcon v#{VERSION} taking flight! Using #{self.container_class} #{self.container_options}."
122
132
  buffer.puts "- Running on #{RUBY_DESCRIPTION}"
123
133
  buffer.puts "- Binding to: #{self.endpoint}"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2025, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "serve"
7
7
  require_relative "host"
@@ -58,7 +58,7 @@ module Falcon
58
58
  # @parameter encoding [Encoding] Defaults to `Encoding::UTF_8`.
59
59
  def update_external_encoding!(encoding = Encoding::UTF_8)
60
60
  if Encoding.default_external != encoding
61
- Console.logger.warn(self) {"Updating Encoding.default_external from #{Encoding.default_external} to #{encoding}"}
61
+ Console.warn(self){"Updating Encoding.default_external from #{Encoding.default_external} to #{encoding}"}
62
62
  Encoding.default_external = encoding
63
63
  end
64
64
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2025, by Samuel Williams.
4
+ # Copyright, 2018-2026, by Samuel Williams.
5
5
 
6
6
  require "async/service"
7
7
 
@@ -31,6 +31,8 @@ module Falcon
31
31
  # @attribute [Array(String)]
32
32
  many :paths
33
33
 
34
+ # Create the environment for the virtual host service.
35
+ # @returns [Async::Service::Environment] The configured virtual environment.
34
36
  def environment
35
37
  Async::Service::Environment.new(Falcon::Environment::Virtual).with(
36
38
  verbose: self.parent&.verbose?,
@@ -41,6 +43,8 @@ module Falcon
41
43
  )
42
44
  end
43
45
 
46
+ # Build the service configuration for the virtual host.
47
+ # @returns [Async::Service::Configuration] The service configuration.
44
48
  def configuration
45
49
  Async::Service::Configuration.new.tap do |configuration|
46
50
  configuration.add(self.environment)
@@ -49,7 +53,7 @@ module Falcon
49
53
 
50
54
  # Prepare the environment and run the controller.
51
55
  def call
52
- Console.logger.info(self) do |buffer|
56
+ Console.info(self) do |buffer|
53
57
  buffer.puts "Falcon Virtual v#{VERSION} taking flight!"
54
58
  buffer.puts "- Running on #{RUBY_DESCRIPTION}"
55
59
  buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2025, by Samuel Williams.
4
+ # Copyright, 2017-2026, by Samuel Williams.
5
5
  # Copyright, 2018, by Mitsutaka Mimura.
6
6
 
7
7
  require_relative "command/top"
8
8
 
9
9
  module Falcon
10
+ # @namespace
10
11
  module Command
11
12
  # The main entry point for the `falcon` executable.
12
13
  # @parameter arguments [Array(String)] The command line arguments.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2026, by Samuel Williams.
5
5
 
6
6
  require "async"
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2024, by Samuel Williams.
4
+ # Copyright, 2024-2026, by Samuel Williams.
5
5
 
6
6
  module Falcon
7
7
  module Environment
@@ -25,8 +25,10 @@ module Falcon
25
25
  end
26
26
  end
27
27
 
28
+ # Load the configuration from all resolved configuration paths.
29
+ # @returns [Async::Service::Configuration] The loaded configuration.
28
30
  def configuration
29
- ::Async::Service::Configuration.load(resolved_configuration_paths)
31
+ Async::Service::Configuration.load(resolved_configuration_paths)
30
32
  end
31
33
  end
32
34
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "tls"
7
7
  require_relative "../environment"
@@ -28,7 +28,5 @@ module Falcon
28
28
  File.join(lets_encrypt_root, authority, "privkey.pem")
29
29
  end
30
30
  end
31
-
32
- LEGACY_ENVIRONMENTS[:lets_encrypt_tls] = LetsEncryptTLS
33
31
  end
34
32
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "server"
7
7
  require_relative "../tls"
@@ -40,13 +40,8 @@ module Falcon
40
40
 
41
41
  # next unless environment.implements?(Falcon::Environment::Application)
42
42
  if evaluator.key?(:authority) and evaluator.key?(:ssl_context) and evaluator.key?(:endpoint)
43
- Console.info(self) {"Proxying #{self.url} to #{evaluator.authority} using #{evaluator.endpoint}"}
43
+ Console.info(self){"Proxying #{self.url} to #{evaluator.authority} using #{evaluator.endpoint}"}
44
44
  hosts[evaluator.authority] = evaluator
45
-
46
- if RUBY_VERSION < "3.1"
47
- # Ensure the SSL context is set up before forking - it's buggy on Ruby < 3.1:
48
- evaluator.ssl_context
49
- end
50
45
  end
51
46
  end
52
47
 
@@ -60,13 +55,13 @@ module Falcon
60
55
  hosts = self.hosts
61
56
 
62
57
  if host = hosts[hostname]
63
- Console.logger.debug(self) {"Resolving #{hostname} -> #{host}"}
58
+ Console.debug(self){"Resolving #{hostname} -> #{host}"}
64
59
 
65
60
  socket.hostname = hostname
66
61
 
67
62
  return host.ssl_context
68
63
  else
69
- Console.logger.warn(self, hosts: hosts.keys) {"Unable to resolve #{hostname}!"}
64
+ Console.warn(self, hosts: hosts.keys){"Unable to resolve #{hostname}!"}
70
65
 
71
66
  return nil
72
67
  end
@@ -97,11 +92,11 @@ module Falcon
97
92
  )
98
93
  end
99
94
 
95
+ # Build the proxy middleware with the configured hosts.
96
+ # @returns [Middleware::Proxy] The proxy middleware instance.
100
97
  def middleware
101
98
  return Middleware::Proxy.new(Middleware::BadRequest, self.hosts)
102
99
  end
103
100
  end
104
-
105
- LEGACY_ENVIRONMENTS[:proxy] = Proxy
106
101
  end
107
102
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2024, by Samuel Williams.
4
+ # Copyright, 2024-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "application"
7
7
  require_relative "rackup"
@@ -14,7 +14,5 @@ module Falcon
14
14
  include Application
15
15
  include Rackup
16
16
  end
17
-
18
- LEGACY_ENVIRONMENTS[:rack] = Rack
19
17
  end
20
18
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2024, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require "rack/builder"
7
7
  require_relative "../server"
@@ -10,14 +10,20 @@ module Falcon
10
10
  module Environment
11
11
  # Provides an environment for hosting loading a Rackup `config.ru` file.
12
12
  module Rackup
13
+ # The path to the rackup configuration file.
14
+ # @returns [String] The absolute path to the rackup file.
13
15
  def rackup_path
14
16
  File.expand_path("config.ru", root)
15
17
  end
16
18
 
19
+ # Parse and load the rack application from the rackup file.
20
+ # @returns [Protocol::Rack::Adapter] The parsed rack application.
17
21
  def rack_app
18
22
  ::Protocol::Rack::Adapter.parse_file(rackup_path)
19
23
  end
20
24
 
25
+ # Build the middleware stack for the rack application.
26
+ # @returns [Protocol::HTTP::Middleware] The middleware stack.
21
27
  def middleware
22
28
  ::Falcon::Server.middleware(rack_app, verbose: verbose, cache: cache)
23
29
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2025, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "server"
7
7
  require_relative "application"
@@ -13,10 +13,14 @@ module Falcon
13
13
  module Redirect
14
14
  include Server
15
15
 
16
+ # The URL template to redirect to.
17
+ # @returns [String] The redirect URL template.
16
18
  def redirect_url
17
19
  "https://[::]:443"
18
20
  end
19
21
 
22
+ # Parse the redirect URL into an endpoint.
23
+ # @returns [Async::HTTP::Endpoint] The redirect endpoint.
20
24
  def redirect_endpoint
21
25
  Async::HTTP::Endpoint.parse(redirect_url)
22
26
  end
@@ -27,6 +31,8 @@ module Falcon
27
31
  []
28
32
  end
29
33
 
34
+ # Build a hash of host authorities to their evaluators for redirect matching.
35
+ # @returns [Hash(String, Async::Service::Environment::Evaluator)] Map of host authorities to evaluators.
30
36
  def hosts
31
37
  hosts = {}
32
38
 
@@ -34,7 +40,7 @@ module Falcon
34
40
  evaluator = environment.evaluator
35
41
 
36
42
  if environment.implements?(Falcon::Environment::Application)
37
- Console.info(self) {"Redirecting #{self.url} to #{evaluator.authority}"}
43
+ Console.info(self){"Redirecting #{self.url} to #{evaluator.authority}"}
38
44
  hosts[evaluator.authority] = evaluator
39
45
  end
40
46
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2024, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  require "localhost/authority"
7
7
  require_relative "tls"
@@ -39,7 +39,5 @@ module Falcon
39
39
  end
40
40
  end
41
41
  end
42
-
43
- LEGACY_ENVIRONMENTS[:self_signed_tls] = SelfSignedTLS
44
42
  end
45
43
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2025, by Samuel Williams.
4
+ # Copyright, 2020-2026, by Samuel Williams.
5
5
 
6
6
  require "async/service/managed/environment"
7
7
  require "async/http/endpoint"
@@ -72,7 +72,7 @@ module Falcon
72
72
  # @parameter endpoint [IO::Endpoint] The endpoint to bind to.
73
73
  # @returns [Falcon::Server] The server instance.
74
74
  def make_server(endpoint)
75
- Falcon::Server.new(self.middleware, endpoint, protocol: self.endpoint.protocol, scheme: self.endpoint.scheme)
75
+ Falcon::Server.new(self.middleware, endpoint, protocol: self.endpoint.protocol, scheme: self.endpoint.scheme, utilization_registry: self[:utilization_registry])
76
76
  end
77
77
  end
78
78
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2024, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "../tls"
7
7
  require_relative "../environment"
@@ -92,6 +92,5 @@ module Falcon
92
92
  end
93
93
  end
94
94
 
95
- LEGACY_ENVIRONMENTS[:tls] = TLS
96
95
  end
97
96
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2024, by Samuel Williams.
4
+ # Copyright, 2024-2026, by Samuel Williams.
5
5
 
6
6
  require_relative "configured"
7
7
 
@@ -9,6 +9,7 @@ require_relative "../service/virtual"
9
9
 
10
10
  module Falcon
11
11
  module Environment
12
+ # Provides an environment for running virtual hosts with front-end proxy and redirect services.
12
13
  module Virtual
13
14
  include Configured
14
15
 
@@ -18,6 +19,8 @@ module Falcon
18
19
  Service::Virtual
19
20
  end
20
21
 
22
+ # The name of the virtual host service.
23
+ # @returns [String] The service class name.
21
24
  def name
22
25
  service_class.name
23
26
  end
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2024, by Samuel Williams.
4
+ # Copyright, 2019-2026, by Samuel Williams.
5
5
 
6
6
  module Falcon
7
7
  # Pre-defined environments for hosting web applications.
8
- #
9
- # See {Configuration::Loader#load} for more details.
10
8
  module Environment
11
- LEGACY_ENVIRONMENTS = {}
12
9
  end
13
10
  end