-
Hello. 👋 I noticed you can pass a path to your bundle exec falcon host config/falcon.rb The problem is, upon launch, you'll get this error:
As workaround, I had to monkey patch Falcon's Rackup as follows: module Falcon::Environment::Rackup
def rackup_path = Pathname("config.ru").expand_path.to_s
end The above made everything work. Here's the full details: `config/falcon.rb`# frozen_string_literal: true
require "pathname"
load :rack, :tls
hostname = Pathname("..").expand_path.basename.to_s
port = ENV.fetch "PORT", 2443
ssl_certificate = Pathname("~/.local/state/localhost.rb/localhost.crt").expand_path.to_s
ssl_private_key = Pathname("~/.local/state/localhost.rb/localhost.key").expand_path.to_s
module Falcon::Environment::Rackup
def rackup_path = Pathname("config.ru").expand_path.to_s
end
rack hostname, :tls do
cache false
count ENV.fetch("FALCON_COUNT", 1).to_i
endpoint { Async::HTTP::Endpoint.for "https", "localhost", port:, ssl_context: }
ssl_certificate_path { ssl_certificate }
ssl_private_key_path { ssl_private_key }
end Is there a way to use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Yes absolutely. I have not tested this, but this should give you an idea of how to achieve what you want: # frozen_string_literal: true
require "falcon/environment/rack"
require "falcon/environment/tls"
require "pathname"
hostname = Pathname("..").expand_path.basename.to_s
service hostname do
include Falcon::Environment::Rack
include Falcon::Environment::TLS
rackup_path { Pathname.new(self.root).join("../config.ru").to_s }
ssl_certificate_path do
Pathname("~/.local/state/localhost.rb/localhost.crt").expand_path.to_s
end
ssl_private_key_path do
Pathname("~/.local/state/localhost.rb/localhost.key").expand_path.to_s
end
cache false
count { ENV.fetch("FALCON_COUNT", 1).to_i }
port { ENV.fetch("PORT", 2443).to_i }
endpoint { Async::HTTP::Endpoint.for "https", "localhost", port:, ssl_context: }
end I've also taken the liberty to update your configuration file according to the new syntax and I've made some minor edits according to my own canonical method of writing these configurations. There is one other option to consider - the |
Beta Was this translation helpful? Give feedback.
Yes absolutely. I have not tested this, but this should give you an idea of how to achieve what you want: