File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -91,27 +91,29 @@ web: bundle exec falcon host
9191require " falcon/environment/rack"
9292
9393hostname = File .basename(__dir__ )
94- port = ENV [" PORT" ] || 3000
9594
9695service hostname do
9796 include Falcon ::Environment ::Rack
98-
97+
9998 # By default, Falcon uses Etc.nprocessors to set the count, which is likely incorrect on shared hosts like Heroku.
10099 # Review the following for guidance about how to find the right value for your app:
101100 # https://help.heroku.com/88G3XLA6/what-is-an-acceptable-amount-of-dyno-load
102101 # https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#workers
103102 count ENV .fetch(" WEB_CONCURRENCY" , 1 ).to_i
104-
103+
105104 # If using count > 1 you may want to preload your app to reduce memory usage and increase performance:
106105 preload " preload.rb"
107106
107+ port {ENV .fetch(" PORT" , 3000 ).to_i}
108+
108109 # Heroku only supports HTTP/1.1 at the time of this writing. Review the following for possible updates in the future:
109110 # https://devcenter.heroku.com/articles/http-routing#http-versions-supported
110111 # https://github.com/heroku/roadmap/issues/34
111- endpoint Async ::HTTP ::Endpoint
112- .parse(" http://0.0.0.0:#{ port } " )
113- .with(protocol: Async ::HTTP ::Protocol ::HTTP11 )
114- end
112+ endpoint do
113+ Async ::HTTP ::Endpoint
114+ .parse(" http://0.0.0.0:#{ port } " )
115+ .with(protocol: Async ::HTTP ::Protocol ::HTTP11 )
116+ end
115117~~~
116118
117119~~~ ruby
Original file line number Diff line number Diff line change @@ -32,15 +32,22 @@ The `falcon serve` command is only intended to be used for local development. Fo
3232require " falcon/environment/rack"
3333
3434hostname = File .basename(__dir__ )
35- port = ENV [" PORT" ] || 3000
3635
3736service hostname do
3837 include Falcon ::Environment ::Rack
3938
4039 # This file will be loaded in the main process before forking.
4140 preload " preload.rb"
4241
43- endpoint Async ::HTTP ::Endpoint .parse(" http://0.0.0.0:#{ port } " )
42+ # Default to port 3000 unless otherwise specified.
43+ port {ENV .fetch(" PORT" , 3000 ).to_i}
44+
45+ # Default to HTTP/1.1.
46+ endpoint do
47+ Async ::HTTP ::Endpoint
48+ .parse(" http://0.0.0.0:#{ port } " )
49+ .with(protocol: Async ::HTTP ::Protocol ::HTTP11 )
50+ end
4451end
4552~~~
4653
You can’t perform that action at this time.
0 commit comments