Commit 53fb244d by tady

add IP restriction setting

parent 7211f168
...@@ -6,3 +6,4 @@ RV_S3_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...@@ -6,3 +6,4 @@ RV_S3_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
RV_S3_BACKET_NAME=xxxxxxxxxxxxxxxxxxxxx RV_S3_BACKET_NAME=xxxxxxxxxxxxxxxxxxxxx
RV_PDF_UPLOADING=1 RV_PDF_UPLOADING=1
DATABASE_URL=mysql2://user:passwd@localhost/rendezvous_development DATABASE_URL=mysql2://user:passwd@localhost/rendezvous_development
RV_ALLOW_IPS=1.1.1.1,2.2.2.2
...@@ -158,3 +158,6 @@ gem 'rmagick', :require => 'RMagick' ...@@ -158,3 +158,6 @@ gem 'rmagick', :require => 'RMagick'
# for heroku # for heroku
gem 'rails_12factor', group: :production gem 'rails_12factor', group: :production
gem 'mysql' gem 'mysql'
# for IP restriction
gem 'rack-contrib', require: 'rack/contrib'
...@@ -282,6 +282,8 @@ GEM ...@@ -282,6 +282,8 @@ GEM
pry-rails (0.3.2) pry-rails (0.3.2)
pry (>= 0.9.10) pry (>= 0.9.10)
rack (1.5.2) rack (1.5.2)
rack-contrib (1.2.0)
rack (>= 0.9.1)
rack-mini-profiler (0.9.2) rack-mini-profiler (0.9.2)
rack (>= 1.1.3) rack (>= 1.1.3)
rack-test (0.6.2) rack-test (0.6.2)
...@@ -466,6 +468,7 @@ DEPENDENCIES ...@@ -466,6 +468,7 @@ DEPENDENCIES
poltergeist poltergeist
premailer premailer
pry-rails pry-rails
rack-contrib
rack-mini-profiler rack-mini-profiler
rails (~> 4.1) rails (~> 4.1)
rails_12factor rails_12factor
......
...@@ -32,6 +32,11 @@ module Rendezvous ...@@ -32,6 +32,11 @@ module Rendezvous
# oauth2_token: 'FIXME', # oauth2_token: 'FIXME',
# account: 'FIXME' # account: 'FIXME'
} }
# IP restriction.
if Rails.env.production? && ENV['RV_ALLOW_IPS']
config.middleware.use Rack::Access, { "/" => ENV['RV_ALLOW_IPS'].split(/,/) }
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment