Skip to content

Commit bd99eeb

Browse files
committed
Fixes #17
1 parent 5d83a50 commit bd99eeb

4 files changed

Lines changed: 30 additions & 1 deletion

File tree

config/environments/development.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
# Show full error reports.
1313
config.consider_all_requests_local = true
1414

15+
# Allowed hosts
16+
if ENV["ALLOWED_HOST_REGEX"].present?
17+
config.hosts << Regexp.new(ENV['ALLOWED_HOST_REGEX'])
18+
end
19+
if ENV['HOST_NAME'].present?
20+
config.hosts << ENV['HOST_NAME']
21+
end
22+
1523
# Enable/disable caching. By default caching is disabled.
1624
# Run rails dev:cache to toggle caching.
1725
if Rails.root.join("tmp", "caching-dev.txt").exist?

config/environments/production.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
config.consider_all_requests_local = true
1818
config.action_controller.perform_caching = true
1919

20+
# Allowed hosts
21+
if ENV["ALLOWED_HOST_REGEX"].present?
22+
config.hosts << Regexp.new(ENV['ALLOWED_HOST_REGEX'])
23+
end
24+
if ENV['HOST_NAME'].present?
25+
config.hosts << ENV['HOST_NAME']
26+
end
27+
2028
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
2129
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
2230
# config.require_master_key = true

config/environments/test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
config.consider_all_requests_local = true
2424
config.action_controller.perform_caching = false
2525

26+
# Allowed hosts
27+
if ENV["ALLOWED_HOST_REGEX"].present?
28+
config.hosts << Regexp.new(ENV['ALLOWED_HOST_REGEX'])
29+
end
30+
if ENV['HOST_NAME'].present?
31+
config.hosts << ENV['HOST_NAME']
32+
end
33+
2634
# Raise exceptions instead of rendering exception templates.
2735
config.action_dispatch.show_exceptions = false
2836

example.env

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ SECRET_KEY_BASE="beefaroni"
77
RAILS_ENV=development
88
PUMA_ENV=development
99

10+
# If both ALLOWED_HOSTS_REGEX and HOST_NAME are populated, both will be allowed
11+
# ALLOWED_HOSTS_REGEX=/.*\.compute\.amazonaws\.com/
12+
ALLOWED_HOSTS_REGEX=
13+
HOST_NAME=
14+
1015
BUNDLE_GEMFILE=Gemfile
1116
# BUNDLE_PATH=/app/scholarspace/bundle
1217
CH12N_TOOL=fits_servlet
@@ -70,4 +75,4 @@ AWS_ACCESS_KEY=
7075
AWS_SECRET_KEY=
7176
S3_BUCKET_NAME=
7277
# Optional -- for pointing Fedora to a specific path within a bucket
73-
S3_PREFIX=
78+
S3_PREFIX=

0 commit comments

Comments
 (0)