Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No need to care about the port gotchas with foreman now that we can use ssl_bind in the Puma config: puma/puma#2764 Close #309
- Loading branch information
Showing
10 changed files
with
114 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
formation: ssl=1 | ||
formation: web=1 | ||
port: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
web: bundle exec puma -C config/puma.rb | ||
ssl: bundle exec puma -b tcp://localhost:$(($PORT-100)) -b ssl://localhost:$(($PORT-100-1000)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
class App | ||
class << self | ||
def port | ||
ENV.fetch("PORT", 3000).to_i | ||
end | ||
|
||
def ssl_port | ||
port - 1000 | ||
end | ||
|
||
def env | ||
ENV.fetch("RACK_ENV", "development") | ||
end | ||
|
||
def production? | ||
env == "production" | ||
end | ||
|
||
def development? | ||
env == "development" | ||
end | ||
|
||
def test? | ||
env == "test" | ||
end | ||
|
||
def localhost_ssl? | ||
return true if development? | ||
|
||
# to force use when "simulating" production | ||
ENV.key?("LOAD_LOCALHOST_SSL") | ||
end | ||
|
||
def redirect_to_https? | ||
return true if production? | ||
|
||
%w(1 true).include?(ENV["REDIRECT_TO_HTTPS"]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.