Skip to content

Commit

Permalink
Fix virtual.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Mar 19, 2024
1 parent 156e9b7 commit 64c95b8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 4 additions & 0 deletions lib/falcon/command/top.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
require_relative 'serve'
require_relative 'host'
require_relative 'virtual'
require_relative 'proxy'
require_relative 'redirect'
require_relative 'supervisor'

require_relative '../version'
Expand Down Expand Up @@ -34,6 +36,8 @@ class Top < Samovar::Command
'serve' => Serve,
'host' => Host,
'virtual' => Virtual,
'proxy' => Proxy,
'redirect' => Redirect,
'supervisor' => Supervisor,
}, default: 'serve'

Expand Down
4 changes: 1 addition & 3 deletions lib/falcon/command/virtual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class Virtual < Samovar::Command
# @attribute [Array(String)]
many :paths

include Paths

def environment
Async::Service::Environment.new(Falcon::Service::Virtual::Environment).with(
verbose: self.parent&.verbose?,
Expand All @@ -43,7 +41,7 @@ def environment
end

def configuration
super.tap do |configuration|
Async::Service::Configuration.new.tap do |configuration|
configuration.add(self.environment)
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/falcon/service/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Copyright, 2020-2023, by Samuel Williams.

require_relative 'server'
require_relative '../tls'
require_relative '../middleware/proxy'

require 'async/http/endpoint'
require 'async/io/shared_endpoint'
Expand Down
5 changes: 5 additions & 0 deletions lib/falcon/service/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def cache
def client_endpoint
::Async::HTTP::Endpoint.parse(url)
end

# Any scripts to preload before starting the server.
def preload
[]
end
end

def self.included(target)
Expand Down
16 changes: 8 additions & 8 deletions lib/falcon/service/virtual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def service_class
# All the falcon application configuration paths.
# @returns [Array(String)] Paths to the falcon application configuration files.
def configuration_paths
File.glob("/srv/http/*/falcon.rb")
["/srv/http/*/falcon.rb"]
end

def configuration
Expand Down Expand Up @@ -128,18 +128,18 @@ def setup(container)

container.spawn(name: "Falcon Redirector", restart: true, key: :redirect) do |instance|
instance.exec(falcon_path, "redirect",
"--bind", @command.bind_insecure,
"--timeout", @command.timeout.to_s,
"--redirect", @command.bind_secure,
*@command.paths, ready: false
"--bind", evaluator.bind_insecure,
"--timeout", evaluator.timeout.to_s,
"--redirect", evaluator.bind_secure,
*evaluator.configuration_paths, ready: false
)
end

container.spawn(name: "Falcon Proxy", restart: true, key: :proxy) do |instance|
instance.exec(falcon_path, "proxy",
"--bind", @command.bind_secure,
"--timeout", @command.timeout.to_s,
*@command.paths, ready: false
"--bind", evaluator.bind_secure,
"--timeout", evaluator.timeout.to_s,
*evaluator.configuration_paths, ready: false
)
end
end
Expand Down

0 comments on commit 64c95b8

Please sign in to comment.