Class: Falcon::Command::Redirect
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Falcon::Command::Redirect
- Includes:
- Paths
- Defined in:
- lib/falcon/command/redirect.rb
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
One or more paths to the configuration files.
Instance Method Summary collapse
-
#call ⇒ Object
Prepare the environment and run the controller.
- #configuration ⇒ Object
-
#endpoint(**options) ⇒ Object
The endpoint to bind to.
- #environment(**options) ⇒ Object
-
#redirect_endpoint(**options) ⇒ Object
The template endpoint to redirect to.
Methods included from Paths
Instance Attribute Details
#paths ⇒ Object (readonly)
One or more paths to the configuration files.
28 |
# File 'lib/falcon/command/redirect.rb', line 28 many :paths |
Instance Method Details
#call ⇒ Object
Prepare the environment and run the controller.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/falcon/command/redirect.rb', line 51 def call Console.logger.info(self) do |buffer| buffer.puts "Falcon Redirect v#{VERSION} taking flight!" buffer.puts "- Binding to: #{@options[:bind]}" buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}" buffer.puts "- To reload: kill -HUP #{Process.pid}" self.resolved_paths.each do |path| buffer.puts "- Loading configuration from #{path}" end end Async::Service::Controller.run(self.configuration) end |
#configuration ⇒ Object
44 45 46 47 48 |
# File 'lib/falcon/command/redirect.rb', line 44 def configuration Configuration.for( self.environment(environments: super.environments) ) end |
#endpoint(**options) ⇒ Object
The endpoint to bind to.
67 68 69 |
# File 'lib/falcon/command/redirect.rb', line 67 def endpoint(**) Async::HTTP::Endpoint.parse(@options[:bind], timeout: @options[:timeout], **) end |
#environment(**options) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/falcon/command/redirect.rb', line 32 def environment(**) Async::Service::Environment.new(Falcon::Environment::Redirect).with( root: Dir.pwd, name: self.class.name, verbose: self.parent&.verbose?, url: @options[:bind], redirect_url: @options[:redirect], timeout: @options[:timeout], ** ) end |
#redirect_endpoint(**options) ⇒ Object
The template endpoint to redirect to.
72 73 74 |
# File 'lib/falcon/command/redirect.rb', line 72 def redirect_endpoint(**) Async::HTTP::Endpoint.parse(@options[:redirect], **) end |