Skip to content

Commit 2cba71e

Browse files
committed
Purge use of load in service configurations.
1 parent ef7dfee commit 2cba71e

File tree

13 files changed

+40
-113
lines changed

13 files changed

+40
-113
lines changed

examples/beer/falcon.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@
44
# Released under the MIT License.
55
# Copyright, 2019-2025, by Samuel Williams.
66

7-
load :rack, :self_signed_tls, :supervisor
7+
require "falcon/environment/rack"
8+
require "falcon/environment/self_signed_tls"
9+
require "falcon/environment/supervisor"
810

9-
rack "beer.localhost", :self_signed_tls
11+
service "beer.localhost" do
12+
include Falcon::Environment::Rack
13+
include Falcon::Environment::SelfSignedTLS
14+
end
1015

11-
supervisor
16+
service "supervisor" do
17+
include Falcon::Environment::Supervisor
18+
end

examples/benchmark/falcon.rb

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
# Released under the MIT License.
55
# Copyright, 2019-2025, by Samuel Williams.
66

7-
load :rack, :self_signed_tls, :supervisor
7+
require "falcon/environment/rack"
8+
require "falcon/environment/self_signed_tls"
9+
require "falcon/environment/supervisor"
810

9-
rack "benchmark.local", :self_signed_tls
11+
service "benchmark.localhost" do
12+
include Falcon::Environment::Rack
13+
include Falcon::Environment::SelfSignedTLS
14+
end
15+
16+
service "supervisor" do
17+
include Falcon::Environment::Supervisor
18+
end

examples/bug/config.ru

-24
This file was deleted.

examples/bug/falcon.rb

-14
This file was deleted.

examples/google/falcon.rb

-17
This file was deleted.

examples/proxy/falcon.rb

100644100755
File mode changed.

examples/streaming_upload/falcon.rb

-14
This file was deleted.

examples/trailer/falcon.rb

-11
This file was deleted.

guides/deployment/readme.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ Here is a basic example which hosts a rack application using :
2222
#!/usr/bin/env falcon-host
2323
# frozen_string_literal: true
2424

25-
load :rack, :supervisor
25+
require "falcon/environment/rack"
26+
require "falcon/environment/lets_encrypt_tls"
27+
require "falcon/environment/supervisor"
2628

2729
hostname = File.basename(__dir__)
2830
service hostname do
@@ -48,7 +50,8 @@ The environment configuration is defined in the `Falcon::Environment` module. Th
4850
#!/usr/bin/env falcon-host
4951
# frozen_string_literal: true
5052

51-
load :rack, :supervisor
53+
require "falcon/environment/rack"
54+
require "falcon/environment/supervisor"
5255

5356
hostname = File.basename(__dir__)
5457
service hostname do
@@ -82,7 +85,7 @@ web: bundle exec falcon host
8285

8386
#!/usr/bin/env -S falcon host
8487

85-
load :rack
88+
require "falcon/environment/rack"
8689

8790
hostname = File.basename(__dir__)
8891
port = ENV["PORT"] || 3000

guides/rails-integration/readme.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ The `falcon serve` command is only intended to be used for local development. Fo
2727
#!/usr/bin/env -S falcon host
2828
# frozen_string_literal: true
2929

30-
load :rack
30+
require "falcon/environment/rack"
3131

3232
hostname = File.basename(__dir__)
3333
port = ENV["PORT"] || 3000
3434

35-
rack hostname do
36-
append preload "preload.rb"
37-
endpoint Async::HTTP::Endpoint.parse("http://0.0.0.0:#{port}")
35+
service hostname do
36+
include Falcon::Environment::Rack
37+
endpoint Async::HTTP::Endpoint.parse("http://0.0.0.0:#{port}")
3838
end
3939
```
4040

lib/falcon/configuration.rb

+1-15
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,7 @@
99
module Falcon
1010
# Manages environments which describes how to host a specific application.
1111
#
12-
# Environments are key-value maps with lazy value resolution. An environment can inherit from a parent environment, which can provide defaults
13-
#
14-
# A typical configuration file might look something like:
15-
#
16-
# ~~~ ruby
17-
# #!/usr/bin/env falcon-host
18-
# # frozen_string_literal: true
19-
#
20-
# load :rack, :self_signed_tls, :supervisor
21-
#
22-
# supervisor
23-
#
24-
# rack 'hello.localhost', :self_signed_tls do
25-
# end
26-
# ~~~
12+
# Environments are key-value maps with lazy value resolution. An environment can inherit from a parent environment, which can provide defaults or shared configuration.
2713
#
2814
class Configuration < ::Async::Service::Configuration
2915
# Load the specified configuration file. See {Loader#load_file} for more details.

test/falcon/.configuration/proxy.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# Released under the MIT License.
44
# Copyright, 2019-2023, by Samuel Williams.
55

6-
load :proxy
6+
require "falcon/environment/proxy"
77

8-
proxy 'localhost' do
9-
url 'https://www.google.com'
8+
service "localhost" do
9+
include Falcon::Environment::Proxy
10+
url "https://www.google.com"
1011
end

test/falcon/.configuration/rack.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# Copyright, 2020, by Daniel Evans.
55
# Copyright, 2023, by Samuel Williams.
66

7-
load :rack
7+
require "falcon/environment/rack"
88

9-
rack 'localhost' do
10-
count 3
9+
service "localhost" do
10+
include Falcon::Environment::Rack
11+
count 3
1112
end

0 commit comments

Comments
 (0)