Sha256: 4cde586e2460546f5028aa968dad1de5de2299152c8968bda251519ea6702990

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Whiplash
  class App
    class Railtie < Rails::Railtie

      config.before_configuration do |app|
        # App name/etc, mainly for consistency in logging
        app_name = app.class.module_parent.name.underscore.dasherize
        app.config.environment_key = ENV.fetch('ENVIRONMENT_KEY', Rails.env.to_s)
        app.config.application_key = ENV.fetch('APPLICATION_KEY', app_name)
        app.config.application_name_space = [config.application_key, config.environment_key].join('-')
    
        # session settings
        session_days = 30 
        session_seconds = session_days * 24 * 60 * 60
        session_length = ENV.fetch('SESSION_LENGTH', session_seconds).to_i
        app.config.session_length = session_length
        app.config.session_store :cookie_store, :key => '_session', :expire_after => session_length
      end

      initializer "whiplash_app.action_controller" do
        ActiveSupport.on_load(:action_controller) do
          include Whiplash::App::CanonicalHost
          include Whiplash::App::ControllerHelpers
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whiplash-app-0.9.6 lib/whiplash/app/railtie.rb
whiplash-app-0.9.5 lib/whiplash/app/railtie.rb
whiplash-app-0.9.4 lib/whiplash/app/railtie.rb