falcon 0.47.2 → 0.47.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/falcon +1 -1
- data/lib/falcon/command/virtual.rb +2 -3
- data/lib/falcon/environment/configured.rb +29 -0
- data/lib/falcon/environment/virtual.rb +67 -0
- data/lib/falcon/middleware/proxy.rb +3 -3
- data/lib/falcon/service/virtual.rb +4 -68
- data/lib/falcon/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +4 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66c929396dfe5f414b795d6a5a137fea6996975fbf7c2332627cbc801703c7e9
|
4
|
+
data.tar.gz: fe40f4298c221df573c2d9bda0df94e5ca08d37edb33d1647f9ae86fe339c2b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c1a19802cc4a817dd241f55881bd73a0a2182906a671a4358eb109a13abd0002a6aa42800c6d66825ed4fc4c555f64c2712515fd6cfcbb134fd300d31e87061
|
7
|
+
data.tar.gz: 769341ca245aaed0de1d5af95c8e20d62af6c32569d8eb432b2d4178504f6d831da5d88f012293e086b14f01fe8ee0c4914abe91f79073a2544b2b43a68556b3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/falcon
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative '../
|
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::
|
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
|
@@ -140,9 +140,9 @@ module Falcon
|
|
140
140
|
else
|
141
141
|
super
|
142
142
|
end
|
143
|
-
rescue
|
144
|
-
Console.
|
145
|
-
return Protocol::HTTP::Response[502, {'content-type' => 'text/plain'}, [
|
143
|
+
rescue => error
|
144
|
+
Console.error(self, error)
|
145
|
+
return Protocol::HTTP::Response[502, {'content-type' => 'text/plain'}, [error.class.name]]
|
146
146
|
end
|
147
147
|
end
|
148
148
|
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.
|
62
|
+
evaluator.resolved_configuration_paths.each do |path|
|
127
63
|
path = File.expand_path(path)
|
128
64
|
root = File.dirname(path)
|
129
65
|
|
data/lib/falcon/version.rb
CHANGED
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.
|
4
|
+
version: 0.47.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -57,7 +57,7 @@ cert_chain:
|
|
57
57
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
58
58
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
59
59
|
-----END CERTIFICATE-----
|
60
|
-
date: 2024-05-
|
60
|
+
date: 2024-05-08 00:00:00.000000000 Z
|
61
61
|
dependencies:
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: async
|
@@ -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
|