Module: Panmind::SSLHelper

Defined in:
lib/panmind/ssl_helper.rb,
lib/panmind/ssl_helper/railtie.rb

Defined Under Namespace

Modules: Filters, Routing, TestHelpers Classes: Railtie, SSLRefused, SSLRequired

Constant Summary collapse

Version =
'0.9.2'
WITH_SSL =
{:protocol => 'https'}
WITHOUT_SSL =
{:protocol => 'http' }

Class Method Summary collapse

Class Method Details

.set(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/panmind/ssl_helper.rb', line 10

def self.set(options = {})
  return if Rails.env.test? # Because tests make assumptions we cannot break

  https_port = (options[:https_port] || 443).to_i
  http_port  = (options[:http_port]  || 80 ).to_i

  # if we use non-standard ports we must explictly use them in the URIs
  if https_port != 443 || http_port != 80
    WITH_SSL.update(:port => https_port)
    WITHOUT_SSL.update(:port => http_port)
  end
end