Skip to content

Commit

Permalink
Add --preload -> Bundle.require(:preload).
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jul 28, 2019
1 parent b39427b commit 2bab9cb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/falcon/command/serve.rb
Expand Up @@ -32,6 +32,8 @@
require 'rack/builder'
require 'rack/server'

require 'bundler'

module Falcon
module Command
class Serve < Samovar::Command
Expand All @@ -45,6 +47,7 @@ class Serve < Samovar::Command
option '-t/--timeout <duration>', "Specify the maximum time to wait for blocking operations.", type: Float, default: nil

option '-c/--config <path>', "Rackup configuration file to load", default: 'config.ru'
option '--preload', "Preload the bundle before creating containers"

option '--forked | --threaded | --hybrid', "Select a specific parallelism model", key: :container, default: :forked

Expand Down Expand Up @@ -101,7 +104,9 @@ def client
end

def run(verbose = false)
app, _ = load_app(verbose)
if @options[:preload]
Bundler.require(:preload)
end

endpoint = Endpoint.parse(@options[:bind], **endpoint_options)

Expand Down Expand Up @@ -138,6 +143,8 @@ def run(verbose = false)
end
end

app, _ = load_app(verbose)

server = Falcon::Server.new(app, bound_endpoint, endpoint.protocol, endpoint.scheme)

server.run
Expand Down

0 comments on commit 2bab9cb

Please sign in to comment.