falcon 0.47.2 → 0.47.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 964ee00911ef7e2c1f0c702a2d62a64bdcc4185c667baf3aefb5d9b0b1424c4c
4
- data.tar.gz: 435e4811db0ff426a620015e6ed0eebb5cc67cb7e1f52c74cbb9f76e3b0ce301
3
+ metadata.gz: f6c82a0a990f36224ab1ed3f2ae66d9d6593c261de28241d9cc9fb41145f65d0
4
+ data.tar.gz: 71295d17ef57d18739c328c0a7c16598a1cf836abb9457766f04460d05971bfc
5
5
  SHA512:
6
- metadata.gz: 3b0091c2d9ba147d0a5a2852714efd6232b035bd1ac9aa7c031fd7e0363f3a10adbc5ea03d0c2dd78a2e7b2d12331039046a129d88d2d75420c0befe31b47d87
7
- data.tar.gz: e18b35bcffa86c56d29b31bd28cd7823362b7d88279ef2028bd00e615fe63de446ecac0789987d53d9c1989d32725e84777b58b268ec24756354654d853db004
6
+ metadata.gz: 0f9992178910ed2606435d193c6a372a0436364f13490fb9bb9fe1ca6d709909514a375131c8d970d62e0a3000e96cce45903dfff748e4210b29261635b6939b
7
+ data.tar.gz: d02f57c73f46e29824eaaba95d6d908221c0f2b62b2fc92a3596342f15e504737ef972e127f68c93c8d14b94ee4af947f875d929e39ed780d07e704f44bcd646
checksums.yaml.gz.sig CHANGED
Binary file
@@ -3,8 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
- require_relative '../service/virtual'
7
- require_relative 'paths'
6
+ require_relative '../environment/virtual'
8
7
 
9
8
  require 'samovar'
10
9
 
@@ -31,7 +30,7 @@ module Falcon
31
30
  many :paths
32
31
 
33
32
  def environment
34
- Async::Service::Environment.new(Falcon::Service::Virtual::Environment).with(
33
+ Async::Service::Environment.new(Falcon::Environment::Virtual).with(
35
34
  verbose: self.parent&.verbose?,
36
35
  configuration_paths: self.paths,
37
36
  bind_insecure: @options[:bind_insecure],
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2024, by Samuel Williams.
5
+
6
+ module Falcon
7
+ module Environment
8
+ # This module provides a common interface for configuring the Falcon application.
9
+ # @todo Reuse this for proxy and redirect services.
10
+ module Configured
11
+ # All the falcon application configuration paths.
12
+ # @returns [Array(String)] Paths to the falcon application configuration files.
13
+ def configuration_paths
14
+ ["/srv/http/*/falcon.rb"]
15
+ end
16
+
17
+ # All the falcon application configuration paths, with wildcards expanded.
18
+ def resolved_configuration_paths
19
+ configuration_paths.flat_map do |path|
20
+ Dir.glob(path)
21
+ end.uniq
22
+ end
23
+
24
+ def configuration
25
+ ::Async::Service::Configuration.load(resolved_configuration_paths)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2024, by Samuel Williams.
5
+
6
+ require_relative 'configured'
7
+
8
+ require_relative '../service/virtual'
9
+
10
+ module Falcon
11
+ module Environment
12
+ module Virtual
13
+ include Configured
14
+
15
+ # The service class to use for the virtual host.
16
+ # @returns [Class]
17
+ def service_class
18
+ Service::Virtual
19
+ end
20
+
21
+ def name
22
+ service_class.name
23
+ end
24
+
25
+ # The URI to bind the `HTTPS` -> `falcon host` proxy.
26
+ def bind_secure
27
+ "https://[::]:443"
28
+ end
29
+
30
+ # The URI to bind the `HTTP` -> `HTTPS` redirector.
31
+ def bind_insecure
32
+ "http://[::]:80"
33
+ end
34
+
35
+ # The connection timeout to use for incoming connections.
36
+ def timeout
37
+ 10.0
38
+ end
39
+
40
+ # The path to the falcon executable from this gem.
41
+ # @returns [String]
42
+ def falcon_path
43
+ File.expand_path("../../../bin/falcon", __dir__)
44
+ end
45
+
46
+ # # The insecure endpoint for connecting to the {Redirect} instance.
47
+ # def insecure_endpoint(**options)
48
+ # Async::HTTP::Endpoint.parse(bind_insecure, **options)
49
+ # end
50
+
51
+ # # The secure endpoint for connecting to the {Proxy} instance.
52
+ # def secure_endpoint(**options)
53
+ # Async::HTTP::Endpoint.parse(bind_secure, **options)
54
+ # end
55
+
56
+ # # An endpoint suitable for connecting to the specified hostname.
57
+ # def host_endpoint(hostname, **options)
58
+ # endpoint = secure_endpoint(**options)
59
+
60
+ # url = URI.parse(bind_secure)
61
+ # url.hostname = hostname
62
+
63
+ # return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname)
64
+ # end
65
+ end
66
+ end
67
+ end
@@ -12,67 +12,6 @@ module Falcon
12
12
  #
13
13
  # A virtual host is an application bound to a specific authority (essentially a hostname). The virtual controller manages multiple hosts and allows a single server to host multiple applications easily.
14
14
  class Virtual < Async::Service::Generic
15
- module Environment
16
- # The service class to use for the virtual host.
17
- # @returns [Class]
18
- def service_class
19
- Virtual
20
- end
21
-
22
- def name
23
- service_class.name
24
- end
25
-
26
- # All the falcon application configuration paths.
27
- # @returns [Array(String)] Paths to the falcon application configuration files.
28
- def configuration_paths
29
- ["/srv/http/*/falcon.rb"]
30
- end
31
-
32
- def configuration
33
- ::Async::Service::Configuration.load(configuration_paths)
34
- end
35
-
36
- # The URI to bind the `HTTPS` -> `falcon host` proxy.
37
- def bind_secure
38
- "https://[::]:443"
39
- end
40
-
41
- # The URI to bind the `HTTP` -> `HTTPS` redirector.
42
- def bind_insecure
43
- "http://[::]:80"
44
- end
45
-
46
- # The connection timeout to use for incoming connections.
47
- def timeout
48
- 10.0
49
- end
50
-
51
- # # The insecure endpoint for connecting to the {Redirect} instance.
52
- # def insecure_endpoint(**options)
53
- # Async::HTTP::Endpoint.parse(bind_insecure, **options)
54
- # end
55
-
56
- # # The secure endpoint for connecting to the {Proxy} instance.
57
- # def secure_endpoint(**options)
58
- # Async::HTTP::Endpoint.parse(bind_secure, **options)
59
- # end
60
-
61
- # # An endpoint suitable for connecting to the specified hostname.
62
- # def host_endpoint(hostname, **options)
63
- # endpoint = secure_endpoint(**options)
64
-
65
- # url = URI.parse(bind_secure)
66
- # url.hostname = hostname
67
-
68
- # return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname)
69
- # end
70
- end
71
-
72
- def self.included(target)
73
- target.include(Environnment)
74
- end
75
-
76
15
  # Drop privileges according to the user and group of the specified path.
77
16
  # @parameter path [String] The path to the application directory.
78
17
  def assume_privileges(path)
@@ -102,12 +41,6 @@ module Falcon
102
41
  end
103
42
  end
104
43
 
105
- # The path to the falcon executable from this gem.
106
- # @returns [String]
107
- def falcon_path
108
- File.expand_path("../../../bin/falcon", __dir__)
109
- end
110
-
111
44
  # Setup the container with {Redirect} and {Proxy} child processes.
112
45
  # These processes are gracefully restarted if they are already running.
113
46
  # @parameter container [Async::Container::Generic]
@@ -122,8 +55,11 @@ module Falcon
122
55
 
123
56
  container.reload do
124
57
  evaluator = @environment.evaluator
58
+ falcon_path = evaluator.falcon_path
59
+
60
+ Console.info(self, "Loading configurations from:", evaluator.resolved_configuration_paths)
125
61
 
126
- evaluator.configuration_paths.each do |path|
62
+ evaluator.resolved_configuration_paths.each do |path|
127
63
  path = File.expand_path(path)
128
64
  root = File.dirname(path)
129
65
 
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2024, by Samuel Williams.
5
5
 
6
6
  module Falcon
7
- VERSION = "0.47.2"
7
+ VERSION = "0.47.3"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.2
4
+ version: 0.47.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -245,6 +245,7 @@ files:
245
245
  - lib/falcon/endpoint.rb
246
246
  - lib/falcon/environment.rb
247
247
  - lib/falcon/environment/application.rb
248
+ - lib/falcon/environment/configured.rb
248
249
  - lib/falcon/environment/lets_encrypt_tls.rb
249
250
  - lib/falcon/environment/proxy.rb
250
251
  - lib/falcon/environment/rack.rb
@@ -254,6 +255,7 @@ files:
254
255
  - lib/falcon/environment/server.rb
255
256
  - lib/falcon/environment/supervisor.rb
256
257
  - lib/falcon/environment/tls.rb
258
+ - lib/falcon/environment/virtual.rb
257
259
  - lib/falcon/middleware/proxy.rb
258
260
  - lib/falcon/middleware/redirect.rb
259
261
  - lib/falcon/middleware/verbose.rb
metadata.gz.sig CHANGED
Binary file